The B-52 and SR-71 had star tracking systems for that exact reason. Not sure about the B-52 version but the SR-71 worked in daylight.
https://www.glennsmuseum.com/items/b52_astro/
https://theaviationgeekclub-com.cdn.ampproject.org/v/s/theav...
https://www.glennsmuseum.com/items/b52_astro/
https://theaviationgeekclub-com.cdn.ampproject.org/v/s/theav...
Cloud cover, OTOH, is a real killer-- but not a problem for high altitude aircraft.