Despite all the security procedures in place nowadays, cockpit visits are still very much possible on most airlines. Just be sure you ask the flight attendant first, and be ready to take “no” for an answer if the pilots are busy and/or not very social.