When Princess Margaret unveiled a plaque commemorating the 85th anniversary of Peter Pan's statue in Kensington Gardens, she recalled how she was befriended, at the age of three, by the celebrated writer.
Sir James was so impressed with the young princess that he used her words in a play and paid her 14 newly minted pennies by way of royalties.
Princess Margaret explained how Sir James sat next to her at her third birthday party and later wrote a description of their meeting for Cynthia Asquith's book The King's Daughters.
He said: "Some of her presents were on the table, simple things that might have come from the sixpenny shops, but she was in a frenzy of glee over them, especially about one to which she had given the place of honour by her plate.
"I said to her as one astounded, 'Is that really your very own?' and she saw how I envied her and immediately placed it between us with the words 'It is yours and mine'."
Soon after the party, the princess heard someone speak of him, and remarked: "I know that man. He is my greatest friend, and I am his greatest friend."
Barrie incorporated the phrases in his last play, The Boy David, and when he next met the Princess, agreed that, as a collaborator in the production, she would receive a penny for each performance.
The play closed after a short run and Sir James assumed Margaret had forgotten his promise. However, in 1937, her father, George VI, wrote Barrie a playful reminder that, if he did not pay up, he would hear from the royal solicitors.
So the writer drew up a formal agreement to pay, which still exists in the Royal Library at Windsor Castle. It was the last thing Barrie wrote. He died on 19 June, 1937.