It happened in early 1990 in the Persian Gulf, while U.S. carriers and B-52s were holding joint exercises. Two B-52s called the carrier USS Ranger (CV-61) and asked if they could do a fly-by, and the carrier air controller said yes.
When the B-52s reported they were 9 kilometers out, the carrier controller said he didn't see them. The B-52s told the carrier folks to look down. The paint job on the B-52 made it hard to see from above, but as it got closer, the sailors could make it out, and the water the B-52 jets were causing to spray out. It's very, very rare for a USAF aircraft to do a fly-by below the flight deck of a carrier.
But B-52s had been practicing low level flights for years, to come in under Soviet radar. In this case, the B-52 pilots asked the carrier controller if they would like the bombers come around again. The carrier guys said yes, and a lot more sailors had their cameras out this time.
The resulting images are legendary.