An imaginary friend is NOT the result of mental impairment. Actually, those with an imaginary friend are frequently smarter than most people (two brains in one). It's someone who is always with you, thus you are
never alone. He knows you, your greatest desires and your flaws. So he usually judges you... but also the others around you. He comes often when you feel alone and need some help, or need to talk but have nobody trustworthy. An imaginary friend is really helpful, I advise you to try ! But pay attention, if your friend is comic, to not laugh too loud. People could think you're strange, even if it is a good
thing, they're not really tolerant.
PS :
Never let someone tell you he is not
real, “Of course it is happening inside your head, but why on earth should that
mean that it is not
real?” (JKR)