Everybody pretty much agrees that McCartney is the speaker in "Hey Jude," and that there's an autobiographical quality to the song. The only disagreement is over to whom McCartney is speaking.
McCartney explained that the song originated on a visit he paid to John Lennon's wife and child shortly after Lennon left them. Hoping to cheer up Lennon's five-year old son Julian, McCartney wrote him a little song:
Hey Jules, don't make it bad,
Take a sad song and make it better
Julian Lennon, however, didn't remember the incident. In fact, he didn't discover that the song was written for him until he reached adulthood.
His father, on the other hand, always assumed that the song was written about him. He was starting a new relationship with Yoko—and thus the advice McCartney offered—"Hey Jude (John), don't be afraid, / You were made to go out and get her"—seemed appropriate.
Yet on another occasion, Lennon suggested that McCartney was essentially singing to himself, trying to find a way out of the turmoil in his own relationships, both that with his long-time girlfriend and those with his musical partners who were starting to drift in different directions.