I was flying for a major U.S. airline until getting furloughed in January.
Unless something has changed in the past 3 months, there is no problem with a passenger visiting the flight deck before or after the flight. The door is closed and secured before push back, and is opened after arrival. Usually, after arrival is the best time to visit (workload permitting, of course).
So, feel free to ask. If I had time, I was always happy to have a quick visit.