Yes, this is quite easy. As I have my visiting cards of my flying club, so Pilots normally respect a flyer. If you ask FA
to get the permission, the normal answer is straight forward is "NO". So, better to send your Card (may be that your business card) to Captain and said that you would like to meet him and on the back side of the card write message, normally it works.
I observed as usually I fly in Business and First Class, that when I am flying in F/J class the treatment for cockpit visit is better than Tourist/Economy Class.
Certainly, after 9/11 the rules have been changed very mush and pilots are more strict in allowing someone in the cockpit and as I am also a Fun Flyer and have full beard the FAs may be little more conscious about my entry in Cockpit, however I have many friends who are Pilots and when they are in command I got entry very easily.
It was really a very bad act of terrorism (9/11), however its impact on aviation lovers is very long term, as security is everywhere, where someone see camera they become suspicious, Cockpit security is too tight and its reality that sometimes when I visit the cockpit the other passengers become worried as there is something going wrong.
Pray to Allah that peace would be every where. Ameen