"I just got this feeling, this is George," McCartney told Tom Robinson on BBC 6 Music. "I was like George -- writing one of his songs.
"It just wrote itself very easily because it wasn't even me writing it."
McCartney said the song is one of his favorites on his latest album, "Chaos and Creation in the Back Yard," being released in September.
Harrison died of cancer in 2001 at age 58.