But Ms. Gold is loath to leave and not just because of the boys. Through Max and Jaret, Ms. Gold and Jaret’s mother, Hillary Solomon, have become close. Now the families have Thanksgiving together: Appetizers and dessert are in the Gold-Ichelson apartment; dinner is at the Solomons’. It’s a friendship, in fact, that Ms. Gold anticipates outlasting the children’s.

“I can’t make sure that relationships the boys have now will remain strong into the future,” she said. “I don’t know a single person that I was friends with in fifth grade. But Hillary and I will carry through regardless of what happens with the kids.”

In Brooklyn, the Fergusons recognize that their children and the neighbors’ children might eventually grow apart, but they don’t anticipate this happening anytime soon.

“They’re at the age when girls and boys separate and that just isn’t the story for these kids,” Mr. Ferguson said. “They’ll stay like siblings or cousins, even if Lucia goes punk rock and Arlo goes Celine Dion.”

But not all relationships are without tension. Children, like adults, can blow hot and cold on their friends, and the periods of frost can be awkward. It’s difficult enough in the suburbs, but even worse when you’re stuck in a painfully slow prewar elevator with the parents of your child’s frenemy.

In Brooklyn, Ms. Gilmore has learned to turn neighborhood tensions into teachable moments. One recent encounter, she said, presented the “perfect opportunity for my daughter to learn how to talk to people who rub you the wrong way.”

For the Gilmores, the surrounding blocks seem like a small town, their own urban microcosm. And if that means bumping into some people you’d rather not, it also means having close friends nearby. Ms. Gilmore is hoping to make her queen bunk beds work as long as possible. “For now, it’s really doable,” she said.