I once rode on a foreign airlines of an underdeveloped nation, they seemed to sort of let some young, less than 10 years old go up there, whether it was right in the cockpit, that I’m unsure of but the doors of the cockpit were certainly opened up.
I went into a British Airways 747 cockpit in the ‘90s. We were over the Atlantic. That really wasn’t unusual pre 9/11. The pilots let a bunch of people up on the flight deck during that flight.
We went across Indonesia in the early ‘80s on Merpati, an Indonesian airline. They left the cockpit door open the entire time. At one point the sun was in their eyes and they taped newspaper over the window (front) so it wouldn’t bother them. I imagine the airplane was on autopilot. At another point they invited all the children to come up and see the cockpit, sit in the pilots’ seats, and we actually felt the plane move up and down as we saw a kid’s hand moving something up there. Our son was 9, and in my memory we only let him see inside (will have to ask him if he remembers). We had many adventures on that trip along with other times!