Harry Sanborn is a wealthy New York music mogul who has had a 40-year habit of dating women under 30, including his latest conquest, Marin Klein. The two drive to her mother's Hamptons beach house expecting to be alone, but are surprised by Marin's mother, successful playwright Erica Barry, who is there with her sister Zoe.
After an awkward dinner, the night turns disastrous when — during foreplay with Marin — Harry has a heart attack and is rushed to a hospital. The doctor, Julian Mercer, tells Harry to stay nearby for a few days, so Harry ends up staying with Erica. Their personalities clash and make for awkward living arrangements—until they get to know each other. The fact that Harry is dating her daughter and that Julian has fallen for Erica leave the two struggling to deal with relationships.
Marin and Harry agree to break up. He and Erica spend more time together and eventually consummate their relationship. Harry discovers that his improving health means that he no longer has to stay with Erica, so he heads home.
Marin receives news that her father, Dave Klein, Erica's ex-husband, whom Erica still allows to direct her plays, is getting remarried to Kristen, an ear, nose and throat doctor who is only two years older than Marin. Although Erica is unaffected by the news, Marin is devastated and pressures her mother into accompanying her to a family dinner. Erica is the life of the party until she sees Harry at another table with another woman. In the argument that follows, Harry suffers from what he believes is another heart attack, but he is told by the young ER physician, Dr. Martinez, who treats him like her father, that it was only a panic attack.
Although she is heartbroken, Erica figures that these events would be great to use in a play. Harry hears about it and rushes to the NYC theater where it is being rehearsed. Despite her denials, it is quickly obvious that she has used the most personal details of their affair in the play. Erica coolly rebuffs his every insinuation that he cares about her and hints that his character will die in the play—for a laugh. He then has another panic attack and is again treated by Dr. Martinez, who warns him that he needs to learn to "decompress".
Six months pass. Erica's play is a huge success. Harry pays Marin a visit to apologize for anything he ever did to hurt her. She replies that he was nothing but nice to her and happily tells him that she is pregnant and has a new husband. Harry expresses a desire to see Erica. Marin tells him that her mother is in Paris celebrating her birthday. Harry decides to surprise Erica. Remembering how they had once planned to spend their birthdays together there, he shows up at the Parisian restaurant where she is seated at a table. Harry explains that over the past six months he reached out to all of the women he ever had affairs with, and even though repeatedly rebuffed at first, finally broke through. They all had identical harsh stories that helped him learn how "I arrived at being me." He tells Erica that his trip to find her was the last and the farthest. Julian appears. All along, Erica has been waiting at the restaurant for Julian, whom she is now dating.
Harry and Erica get along well during the dinner, but they part outside the restaurant. While he is gazing in heartache over the river Seine, ("Guess who finally gets to be the girl?" he says to himself) Erica pulls up in a taxi. She explains that Julian figured out what was happening between them and decided to step aside to let Erica be with Harry. Harry explains that his search the last six months has made him realize he truly loves Erica. Harry and Erica kiss.
A year later, at a New York restaurant, Erica and Harry, now married, are out with Marin, her husband and her new baby daughter, as one big happy family.

Question: Who is Julian in relation to Harry?
Answer: His doctor
Alternative answer: His ex.