The Object of My Affection
(1998)

When Nina (Jennifer Aniston) finds herself unexpectedly pregnant, she asks her best friend George (Paul Rudd) to help raise the child, instead of the boorish biological father. As time goes on, Nina realizes she is in love with George, who is gay, and cannot return her affections as she wishes.

When the baby is born she asks George to move out.

The movie flashes to several years later - Nina is raising her daughter with the young policeman she met earlier, George and his partner Paul are close friends of the sprawling family. George and Nina go to get coffee, still good friends.

Thanks Mary C!