This did happen in my last flight. I consider making it a quick math quiz for any candidate I have to interview in the future (to see whether it takes him 5 minutes or 5 hours to analyze).
A few minutes after the captain announced that we were flying at forty thousand feet above the sea level, cruising at the speed of 900 km/h, through the window we saw another airplane flying at roughly the opposite direction, but at a slightly lower altitude. Of course, the obvious question was asked: How far is the other plane from us? This is better than the typical Fermi problem. Assuming that that airplane was visible in our 90 degrees field of view for 4 seconds and it flew just as fast as our plane, I did a quick calculation and came up with an answer, the flight trajectory of that plane was 1 km apart from ours.
The other guy was impressed, but he was not convinced. Now, since my math skills are rusty, I am sure I missed a thing or two. Now, what is your take?
(Picture rendered from Jarno's public-domain vectorized aircraft).