While chatting on the phone recently about his new film “While We’re Young” (opening Friday), writer and director Noah Baumbach revealed that he had long wanted to pen a screenplay about a middle-age couple becoming intrigued with another couple a generation or so younger.

“I think contrasting the hopes, aspirations and dreams of Generation X-ers, who are now in their 40s, with a people in their 20s could make for a very funny, yet also poignant, situation,” said Baumbach.

In the film, Ben Stiller and Naomi Watts are the older couple, part of New York’s artistic film world. After trying unsuccessfully to have children, their characters, Josh and Cornelia Srebnick, are resigned to being childless and in fact very aware of the freedom not having kids affords them.

Josh, however, is struggling professionally, as his six-hour, very esoteric documentary is not coming together the way he would have wished. Cornelia, on the other hand, works with her father, who is a very famous non-fiction filmmaker. Josh previously had been the assistant to Cornelia’s dad, played by Charles Grodin. Never living up to the success of his father-in-law is clearly a tough issue for Josh.

The twentysomethings who suddenly enter Josh and Cornelia’s lives are Jamie and Darby, played by Adam Driver and Amanda Seyfried. In short order the Srebnicks become seemingly obsessed with Jamie and Darby and their hip life in the very tony Brooklyn.

For Baumbach, a key element that made the movie work for him was the casting of Driver.

“While it’s obviously funny — and we’re having fun with Ben’s character sort of falling in love in a bromance sort of way with Jamie — I didn’t want to sell that character out and reveal what was to come later on right away,” added Baumbach.  “Casting Adam [who earlier starred in Baumbach’s ‘Frances Ha’] really helps make sense of that, as people will discover when they see the film, because he’s so interesting to watch as an actor. He’s so compelling.”

Another central aspect to the humor he was trying to infuse in his movie was how silly Stiller’s Josh character often acts as he strives to take on Jamie’s affectations and wardrobe — and even a similar bicycle.

“There is something always funny when we watch older people making themselves ridiculous, desperately trying to recapture their youth via a person who is of that younger generation right now,” said Baumbach.

“I think every generation feels that to some degree. In fact, it’s something I find entirely sympathetic — Josh and Cornelia’s immersion in Jamie and Darby’s lives.”

Since Stiller also has carved a successful career as a director, as well as an actor, I asked Baumbach how well Stiller was able to take direction from another boss on the set.

“He takes it very well,” said Baumbach with a sly chuckle. “I think it was freeing for him to just give it over and not worry about everything else going on. I think it’s probably relieving in a way, the ability to turn to the director and say, ‘You figure this [problem] out.’

“I don’t have that outlet, since I’m not an actor, but I can understand it all. I’ve worked with other actors who have directed and they all kind of tend to like giving it over, on that front, when they’ve worked with me.”

One of the subplots in “While We’re Young” centers on new parents Marina and Fletcher, played by Maria Dizzia and the Beastie Boys’ Adam Horovitz, a longtime friend of Baumbach’s whom he’s wanted to cast in one of his films for quite some time. “After I cast [Horovitz] here, I became aware of the poignancy of seeing a Beastie Boy as a middle-aged dad in this film that was all about generational issues,” said Baumbach.

Of course, another humorous twist is exactly how self-absorbed Marina and Fletcher become after their baby is born.

For Baumbach, himself the father of a young child, “I’ve seen both sides of that kiddie obsession thing. … It’s a thing probably very few parents can quite understand: that nobody is going to be as excited about your children as you are!”