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. If you are invited, be mindful of the pilots' time, and ask before snapping pictures. What has your experience been with visiting cockpits on flights?