To ask it after landing is the most recommendable. Just let everyone de-board and then ask the FA. I was happily allowed entry in the cockpit for a quick chat and photo by the FA (she directed me to the pilot to ask).
Although not in the US, see my TR (link in signature)