J K Rowling, the creator of Harry Potter, has gifted the Edinburgh flat where she wrote about the schoolboy wizard, to a friend who, like her, had to struggle as a single mother.

The author is said to have handed over the two-bedroom flat at Hazelbank Terrace, Slateford, to Fiona Wilson, a financial services clerk with whom she made friends when they lived in neighbouring streets in Leith.

Ms Rowling, who last year married Dr Neil Murray at their Perthshire home, was also a single mother living on benefits. It was in her spare time that she created her world-famous character.

Now one of the UK's wealthiest people, she is believed to have paid around (pounds) 40,000 ago for the flat a few years. The property is now likely to be worth several times that figure.

Ms Rowling, whose daughter is eight years old, is well-known for her generosity and helps a number of charities, including the MS Society, Scotland, of which she is patron.

Ms Wilson, who has a daughter the same age as Ms Rowling's, is said to have been born in India but lived mainly in Glasgow and Edinburgh. She declined to comment.

A spokesman for Col-mangetty Scotland PR, which carries out publicity work for the author, would only say: ''It's a personal matter.''