Each time I have asked I have got up there, but always some form of ID was requested. A licence is better than a passport.
Word of warning, however: The 'Maniac on the Flightdeck' stories recently (not the Captain!) have prompted a flurry of exchanges elsewhere on PPRUNE about whether cockpit visits should be allowed. I imagine that some airlines are a bit wary now as well.
Good luck.
------------------
"Take-off is optional, Landing is mandatory"