Autofly,
This is what I write:
Dear Captain,
I have a PPL(A) and a PPL(H), and I'm currently working towards a CPL(H). I was wondering if it would be possible to visit the flight deck, preferably for take-off and/or landing. I realise you have a high workload at those times, so naturally I'd just sit quietly and not expect to be entertained.
Yours Sincerely,
Name/Seat number
I give this to the FA when I board, with a photocopy of my licences, and ask if he/she could give it to the captain, saying it's just a request for a flight deck visit. They can be a little suspicious, so don't put the note in an envelope, and keep it brief as otherwise you hold up the queue. I modified this for Air china, as their FAs don't speak much English; I got to my seat, then asked someone. If possible, it helps to get an aisle seat near the front where you can be easily found, but it's not absolutely necessary. If you don't have a PPL yet, I'd enclose some other ID like a student card or similar, and explain what you do and why you're interested - just anything to prove who you are.
This isn't foolproof; it depends on the captain. And some people do other things; if you do a search on wannabes you'll find lots of advice, as this subject comes up quite often.
Good luck!
------------------
Whirly
To fly is human, to hover, divine.