This song originated with a lyric Peter Allen wrote for a song he was working on with Carole Bayer Sager: "When you get caught between the moon and New York City." Allen and Bayer Sager were recording artists, and also very prolific songwriters - together they composed the 1979 Melissa Manchester hit "Don't Cry Out Loud" and the 1980 Rita Coolidge song "I'd Rather Leave While I'm In Love."
In 1981 Bayer Sager started working with another top songwriter, Burt Bacharach, who produced and composed songs for her solo album Sometimes Late at Night
. When Bacharach got the gig scoring music for the movie Arthur
, starring Dudley Moore, he worked on the music for the theme song with Christopher Cross, and asked Bayer Sager (now his romantic partner) to compose the lyrics. She recalled the line Allen came up with years earlier, and secured his permission to use it. For Allen, this was a very lucrative line, as it earned him a songwriting credit along with Bacharach, Bayer Sager and Cross.
Bacharach and Bayer Sager got married in 1982, five days after this song won an Oscar. They teamed up to write two more #1 hits: "That's What Friends Are For
" by Dionne Warwick & Friends, and "On My Own" by Patti LaBelle & Michael McDonald. In 1985, they adopted a son named Cristopher. The couple divorced in 1991.