The tweet was full of longing. On National Best Friends Day in June, Joe Biden posted a Barack and Joe friendship bracelet on his 2020 campaign Twitter account, with the greeting: “Happy #BestFriendsDay to my friend, @BarackObama.” But Obama? He was silent. No reply. Nothing.

Something was off-kilter in this relationship. Where was the mutual affection, the joyous camaraderie? Anyone who watched these men through two terms in the White House knows their admiration for each other was effusive. We all saw the images: the president and the vice president crying, laughing, hugging, whispering, backslapping, eating ice cream together and strolling contemplatively on the White House grounds.

Indeed, over their eight years together in office, Obama and Biden taught us a lesson in male bonding, often startling us by professing their fondness for each other. Just days before their departure from the White House, the normally reserved Obama drew on William Butler Yeats to extol Biden: “Think where man’s glory most begins and ends, / and say my glory was I had such friends.”

Their companionship became a favorite national story line, and the public added its own chapters by creating touching or humorous memes. What Barack and Joe had with each other, admirers across the country wanted in their own lives. As one woman put it in a post on the CBS News website: “I want a man who looks at me like Biden looks at Obama.”

Now Biden is running for president, and his history with Obama is one of the main planks of his campaign — as central to his candidacy as, say, Elizabeth Warren’s slew of detailed policy proposals is to hers. On the trail, he touts the achievements of the Obama years, highlighting his own role and gluing himself to Obama by describing the presidency as “our administration.” And yet, as Biden relentlessly plays up their link, Obama has been noticeably silent — making this very famous friendship look awfully one-sided.

So what was — and is — the nature of the Obama-Biden relationship? Having closely studied their friendship for my forthcoming book on the subject, I’ve concluded that Barack and Joe adored each other, and probably still do, but it is also true that their own aspirations and their political hopes for America have not always aligned. Their friendship, in other words, was real. But like a lot of friendships, it was complicated.

Vice President Biden and President Obama during a campaign stop in Dayton, Ohio, in October 2012. (Nikki Kahn/The Washington Post)

Their partnership was not predestined. There was no gravitational pull, one man toward the other, no instantaneous clicking of like personalities. Here was a young, cerebral African American who sweated over the precision of his words, and an older, chummy white guy given to impulsively speaking his mind. (Obama and Biden declined to discuss their relationship for my book. Obama declined a similar request for this article, and Biden did not respond.)

In 2005, during their first encounters, Obama was an impatient freshman senator, and Biden a veteran of 32 years. The newcomer had sailed into the chamber on a wave of celebrity. He had delivered an electrifying keynote address at the 2004 Democratic National Convention and won his seat by the largest margin ever in a U.S. Senate contest in Illinois. Newsweek had plastered his smiling image on the cover of its “Who’s Next” issue.

Obama stood apart from his more senior colleagues. His convention speech, his landslide victory and his media stardom made him the coolest member of the staid Senate. He disdained the chamber’s pace and its penchant for grandstanding, while Biden honored its traditions and was, in many ways, one of its stereotypical windbags. The two men served together on the Senate Foreign Relations Committee — where, recalls Antony Blinken, Biden’s staff director on the committee, a gulf existed between them. “They weren’t in sync,” Blinken told me. “Obama would listen to Biden holding forth in the committee and roll his eyes.”

At first, their styles clashed. Obama’s aloofness resisted Biden’s gregariousness.

By 2008, Obama and Biden were political rivals, competitors for the Democratic presidential nomination, but Obama was struck by Biden’s skill on the debate stage. “They mostly didn’t see each other during the campaign except at debates,” Obama senior adviser David Axelrod explained to me. Having watched him blather at committee hearings, Obama was skeptical of how Biden would perform, but he saw something he didn’t expect: a disciplined Biden. “I think he was really impressed by the way Biden handled himself in the debates,” Axelrod said. “Biden was consistently one of the better debaters.”

For his part, Biden was bowled over by Obama’s March 2008 speech on race, which confronted the festering controversy over his relationship with Rev. Jeremiah Wright. Blinken told me that, the day after the address, Biden asked him, “Did you hear that speech?” The future vice president, he recalls, was palpably excited. “That is maybe the best speech I’ve heard a political leader give,” Biden raved. Blinken believes that was a “click moment” for Biden, stirring a “newfound respect and admiration” for Obama.

Biden’s campaign for president soon flamed out, and after Obama secured the nomination he began vetting his former competitor as his running mate. Biden had a clear idea of what he expected of his role as vice president: He wanted to create a relationship based in part on the extraordinary arrangement Vice President Walter Mondale had worked out with President Jimmy Carter 32 years earlier — one that vastly expanded the duties and power of the second-in-command.

Biden, Obama and Sen. Hillary Clinton before a Democratic presidential debate in 2007. (Win McNamee/Getty Images) The two senators during a hearing of the Senate Foreign Relations Committee in April 2008. (Melina Mara/The Washington Post)

From left: Biden, Obama and Sen. Hillary Clinton before a Democratic presidential debate in 2007 (Win McNamee/Getty Images); the two senators during a hearing of the Senate Foreign Relations Committee in April 2008. (Melina Mara/The Washington Post)

Like Biden, Mondale came to the vice presidency after years as a Washington insider and long-term U.S. senator. And like Obama, the president Mondale served was a newcomer to Washington with minimal experience negotiating with Congress. As Biden told a forum titled, “The Mondale Vice Presidency and Its Legacy” in 2015, “The first person I called was Fritz,” referring to Mondale by his nickname. In his early discussions on the position, Biden told Obama that he wanted the president and vice president’s interaction to be deep and personal, even combative if necessary; he wanted to be Obama’s chief counselor; he wanted to be in attendance at every important meeting; he wanted his views considered on every crucial decision on both foreign and domestic policy; he wanted to advise and participate in legislative efforts; he wanted to be the last guy in the room whispering in Obama’s ear; and he wanted a private meeting, perhaps lunch, with the president every week. Maybe most important, given Biden’s nature, he wanted to be able to speak with absolute candor.

Once Biden joined the ticket the two men began a rocky process of accommodation. Their styles clashed. Obama’s aloofness resisted Biden’s gregariousness — and his gaffes. But no one ever fought off Biden’s in-your-face exuberance for long. When Biden spoke out of turn, Obama recognized that his mistakes were not consequential and didn’t impair the partnership; in fact they were often regarded as signs of Biden’s authenticity. Obama and Biden grew not only to admire and respect each other; they developed genuine camaraderie. Liz Allen, who served alternately on the staffs of both Obama and Biden, told me: “They each had to let go of things to trust the other guy.” As a sign of his trust, Obama accepted all of Biden’s demands for the role of the vice president, and throughout their two terms, he was true to the arrangement.

Biden, meanwhile, accepted his role as No. 2. As a senator and a Catholic, he fully understood pecking order. “One of the reasons why I didn’t think he would have a problem being vice president, even though he had really never worked for anyone else,” his longtime friend and adviser Ted Kaufman told me, “was that he was very comfortable in a hierarchical organization. He felt very comfortable being nice to the chairman.” That trait, it turned out, would easily transfer to the White House.

Obama announces Biden as his running mate in 2008 in Illinois. (Linda Davidson/The Washington Post)

Even as the friendship was taking root, politics and self-interest encroached. In October 2010, Bob Woodward appeared on CNN’s John King show to pitch his new book, “Obama’s Wars,” as quiet conversations were underway within the White House over possibly replacing Biden on the ticket in 2012 with Hillary Clinton. King asked him to speculate on the rumors. Woodward, regarded by many as the best-sourced journalist in Washington, said bluntly: “It’s on the table. And some of Hillary Clinton’s advisers see it as a real possibility in 2012. President Obama needs some of the women, Latinos, retirees that she did so well with during the 2008 primaries. And so they switch jobs. … [It’s] not out of the question.”

The White House moved quickly to discredit the idea. The following morning, press secretary Robert Gibbs showed up on CNN’s morning show. “No one in the White House is discussing this as a possibility,” he asserted. But in their book on the 2012 campaign, “Double Down,” Mark Halperin and John Heilemann would later report that discussions and polling on the question had taken place “furtively and obliquely” within “the top echelon of Obamaworld.” The authors concluded that “testing this one might have seemed hard-hearted, but refusing to do so out of affection for Joe would have been soft-headed — which in Obamaworld was the far more grievous crime.” Axelrod privately argued against any change — “swapping Clinton for Biden would have been seen as weak and disloyal,” he wrote in his memoir, “Believer” — while David Plouffe, a top Obama political adviser, insisted in a tweet that there was “never any — any consideration” of a switch and that Obama had “not even entertained it.” However, William Daley, Obama’s former chief of staff, acknowledged to the New York Times that he had orchestrated the research out of simple “due diligence.”

The burbling of the notion persisted in 2011 and 2012. On the first weekend in May 2012, as Obama was officially launching his reelection campaign, Biden appeared on “Meet the Press,” where moderator David Gregory raised this sensitive topic. “Let me talk about the campaign for the presidency,” Gregory said. “Should I assume by virtue of the fact that you’re here today that you’re a lock for the ticket?”

Biden fended off the inquiry by tilting his head down and laughing. The host persisted with a chuckle: “No question about it?”

When he looked up, Biden was grinning: “There’s no — there is no question about it.” He gave a light wave of his arms, as though flicking away the rudeness, and with a big smile and a glint in his eye he joked: “There’s no way out. I mean, they’ve already printed ‘Obama-Biden.’ ”

Sensing Biden’s vulnerability, Gregory plowed on. “Has it annoyed you,” he probed, “that there’s been all of this buzz about, ‘Well, if the president would put in Secretary Clinton, you know, he’d be a shoo-in for reelection, if he would just make that switch?’ ”

Biden resisted Gregory’s taunt and showed his value to the ticket. With a deftness born of years in the public spotlight, he deflected the conversation away from himself and shaped his answer into a defense of Obama. But he tripped over his wording.

“The thing that annoys me about it is the implication that somehow President Clinton is weak and he needs some kind of help,” Biden said — and immediately realized his mistake: “I mean — ”

Gregory beat him to it. “President Obama,” he corrected.

Unfazed, Biden kept talking, demonstrating a trademark example of his loyalty. That anyone would argue that Hillary Clinton should replace Joe Biden, the vice president contended, was merely an attempt to say that Obama needed a boost in the current campaign — and that was ridiculous, in Biden’s view. He turned the slap against himself into an endorsement of the president. In some broken language, he spoke of the president’s strength and his consistent character.

“I think — look, we got the strongest can — … We got the best candidate, man. And he — this guy has a backbone like a ramrod. This — I think we’re just — I think we have clearly the best candidate.”

The results of the White House polling and focus groups had shown that a swap provided no advantage to the ticket, and the idea was set aside. Biden survived. But the private calculations inside the White House might well have given Biden reason to question the president’s commitment to him.

Obama and Biden in the Oval Office in 2011. (Pete Souza/White House) The duo filming a video for first lady Michelle Obama’s “Let’s Move!” initiative in 2014. (Pete Souza/White House)

From left: Obama and Biden in the Oval Office in 2011; the duo filming a video for first lady Michelle Obama’s “Let’s Move!” initiative in 2014. (Pete Souza/White House)

Whatever the political maneuvering, their White House partnership had already blossomed into genuine friendship. And the affection Obama and Biden had for each other was nowhere more pronounced than in the traumatic days of Beau Biden’s illness and death. Beau’s first hint of trouble came in 2010 when he woke up one morning paralyzed on one side of his body and unable to speak. The symptoms, which pointed to a stroke, disappeared after a few hours at a hospital.

Biden had raced off to be with his son, and when he returned, Obama ran to greet the worried father. Axelrod saw the president sprint toward the vice president’s office, he told me, “and I saw them in an embrace.”

Though Beau seemed fine after his stroke scare, uncertainty hovered over the family and everyone close, including the president. One of Obama’s defining virtues was his rigorous preparation for every meeting; he always read his brief and arrived ready for deep engagement in the topic at hand. However, Axelrod recounted to me that at one meeting Obama was unusually distracted. “He simply wasn’t attending,” the senior adviser remembered. “He was looking out the window. People were talking.” But Obama’s mind was elsewhere. “Finally, he said, ‘I don’t know how Joe is going to go on if something happens to Beau.’ ”

Their affection was nowhere more pronounced than in the days of Beau Biden’s illness and death.

Three years later, Obama’s concern became reality. In 2013, Beau was vacationing with his family when he became weak and disoriented. The event was the latest in a series of strange, unexplained episodes that caused the 44-year-old at times to fear he was losing not only his physical health but his mind. Beau was the much-loved two-term attorney general of Delaware, a charming family man who interrupted his first term to deploy to Iraq in 2008 with his National Guard unit. Now he wound up at Northwestern Memorial Hospital in Chicago. Scans showed a brain tumor that was eventually diagnosed as a fast-growing glioblastoma.

Over the next two years, Beau submitted to a range of powerful treatments, and throughout it all, Obama was at Biden’s side. When Biden mentioned during one of their private lunches that he might take a second mortgage on his home for the family’s medical bills, Obama got up from the table and put his hands on his friend’s shoulders. “Don’t do that,” Obama told him, as Biden recounted in his memoir. “I’ll give you the money. I have it. You can pay me back whenever.” (The Biden family never needed to avail itself of Obama’s generosity.) At another weekly lunch together, Biden fought to control his emotions as he filled the president in on the details of Beau’s treatment. He outlined the medical strategy in cold clinical language in the hope that this type of detachment would snuff the welling of his tears. But his performance didn’t fool the president, whose own eyes moistened. “He is not a demonstrative man, in public or in private, and I felt bad,” Biden recalled in his memoir. “I found myself trying to console him.” Finally, Obama said simply: “Life is so difficult to discern.”

During these distressing times, the president used public appearances to send messages of encouragement and friendship to his suffering pal: Without saying a word about Beau, he let the vice president know he was thinking of him. In late April 2015, for instance, Obama delivered a humorous love-gram to Biden at the White House Correspondents’ Association dinner. With his pal in mind, he joked about his presidency having eased into its fourth quarter. “The fact is, I feel more loose and relaxed than ever,” he told the crowd. The reason for his laid-back vibe? “Those Joe Biden shoulder massages,” Obama told the room to a wave of laughter, “they’re like magic.”

The annual gathering came amid controversy over an Indiana law, signed by Gov. Mike Pence, that allowed companies to invoke religious reasons for denying service to gays. “You know what, let me set the record straight,” the tuxedoed Obama said. “I tease Joe sometimes, but he has been at my side for seven years. I love that man.” The room gave Biden, in his absence, a round of applause. And Obama continued on to his punchline: “He’s not just a great vice president, he is a great friend. We’ve gotten so close, in some places in Indiana, they won’t serve us pizza anymore.” Heads flew back in laughter, and the room applauded for both the takedown of the law and Barack’s edgy riff in appreciation of Joe.

But nothing could stop Beau’s condition from worsening. The treatments, though teasing hope, were not going to save him. Soon after Memorial Day, with his entire brood surrounding him, Biden watched as his son’s heart stopped beating.

“I never said this publicly,” former education secretary Arne Duncan told me, “but when Beau was going through hell, obviously, and ultimately died, the president was just an unbelievable personal support to the vice president, and it was my sense that that brought them much closer.” In his conversations with Duncan, Biden revealed that “he was just unbelievably moved and appreciative and grateful for the president’s personal support.”

Obama gives the eulogy at the funeral of Biden’s son Beau, who died in 2015 of brain cancer. (Kevin Lamarque/Pool/AP)

As the 2016 election loomed, however, the tension between politics and friendship flared again. Biden initially felt that his grief over Beau would keep him from entering the race. But in case he gathered enough strength for a run, his aides and friends kept the window open — everyone except his buddy Obama. A careful reading of this period in Biden’s memoir, “Promise Me, Dad,” illuminates the delicate political interplay between the two men. While Biden was gracious and openhearted to Obama in the book, he also laid out scenes revealing that the president was unwilling to support him in 2016; indeed, Obama asserted his considerable will to steer Biden away from his life’s ambition of the presidency.

In January 2015, Obama was already trying to dissuade Biden from leaping into the 2016 race, according to the memoir. “He had been subtly weighing in against — for a variety of reasons,” Biden wrote. Biden suggested one possible Obama motive. If the media were to begin focusing on a Biden candidacy for 2016, that attention would dim the light on Obama, his policies and his legacy as his time in the White House wound down, and turn the public’s gaze onto Biden. “The minute I announced I was running for the nomination,” Biden explained, “Barack and I both knew, coverage in the West Wing would shift from his agenda to my chances.”

Obama relied on political speculation, presented as strategic reasoning, to discourage Biden from pursuing the White House. “The president was convinced I could not beat Hillary, and he worried that a long primary fight would split the party and leave the Democratic nominee vulnerable in the general election,” Biden wrote. Obama also believed Clinton had the better chance of defeating a Republican opponent in the battle for the presidency. Obama, it seemed, was concerned about what a Republican victory would mean for his own place in the history books. His health-care program and other policy initiatives were at risk. “I got it, and never took issue with him,” Biden wrote. “This was about Barack’s legacy, and a significant portion of that legacy had not yet been cast in stone.”

As Biden pondered a 2020 run, the deep complexities of their relationship reemerged.

As Biden mulled running, Obama gently but firmly guided him in the other direction. Some Democrats saw Biden as the party’s best standard-bearer, and a Draft Biden movement picked up steam. “The president was urging caution,” Biden recalled. “He wanted me to make sure I didn’t let this chatter get too loud.” Soon it dawned on Biden that Obama had made up his mind: “I found myself saying, ‘Look, Mr. President, I understand if you’ve made an explicit commitment to Hillary and to Bill Clinton.’ ”

In August, Biden’s aides put forward the view that he was in his strongest position as a candidate in six months. His favorability numbers were higher than anyone running in either party. He scored high on trustworthiness, honesty and empathy, and thumped Clinton in voter surveys in the swing states of Pennsylvania, Ohio and Florida. Momentum was building, and the media was speculating heavily about a Biden candidacy. But Biden hadn’t yet pulled himself out of the shadow Beau had cast over his heart and his life.

When Biden told Obama at one of their weekly lunches that he still was on the fence — that he just didn’t know if he could muster the energy for a campaign — “the president was not encouraging,” Biden wrote. Still, the Biden team believed he could enter the race and win. In October, while Biden’s head was still spinning over what to do, he and his advisers nonetheless plotted out a scenario for a run. Finally at a meeting in late October his staff walked through the nitty-gritty of the campaign’s rollout. All through the presentation, chief strategist Mike Donilon kept his eye on Biden. Donilon, who had been advising Biden for more than 30 years, was a good friend, sensitive to Biden’s needs and moods.

Biden listens as Obama speaks in the East Room of the White House in 2014. (Andrew Harnik/Pool/AP) Obama campaigning with Hillary Clinton in Charlotte in July 2016. (Susan Walsh/AP)

Biden listens as Obama speaks in the East Room of the White House in 2014. (Andrew Harnik/Pool/AP); Obama campaigning with Hillary Clinton in Charlotte in July 2016. (Susan Walsh/AP)

What Donilon detected that night turned his mind. Biden’s jaw was clenched, and Donilon saw unimaginable pain on his face. Biden, according to his memoir, caught his strategist looking and asked what was up. Donilon, who had believed wholeheartedly in the success of a Biden campaign since they started discussions two years earlier, answered simply and definitively: “I don’t think you should do this.”

The next day, Biden stood in the Rose Garden with his wife, Jill, on one side and Obama on the other to announce his decision. He explained that he and his family were working through the grieving process, and it took time. “It may very well be that that process, by the time we get through it, closes the window on mounting a realistic campaign for president,” he explained. “I’ve concluded it has closed.”

Biden didn’t want to be making this announcement. He wanted to run; he wanted more than anything in the world to be president. His son Beau had been sensitive to his father’s ambitions and had believed in him as the candidate with the right values for the country. “You’ve got to run,” he told his father a few years earlier. “I want you to run.” Later, as he struggled with cancer, Beau “tried to make his father promise to run,” according to Maureen Dowd of the New York Times.

But without Obama’s blessing, Biden stayed on the sidelines. Instead, Obama threw his weight behind Hillary Clinton. Perhaps he saw Clinton as his true successor, the one who would confirm his revolutionary stamp on America’s political culture: Here was the first black president passing the baton to the first female president. Biden, after all, despite his many virtues, would be just another white guy aiming for the Oval Office — hardly the symbol of tectonic change that Obama hoped would accompany him into the history books.

Obama presents Biden with the Presidential Medal of Freedom in 2017. (Susan Walsh/AP)

Biden was all heart, Obama all brain. In going with Clinton over Biden, Obama went with the brain rather than the heart. The irony of his decision lingers. We all know what happened to Clinton in November 2016. We also know that Biden was strong in those Midwestern states that were her undoing. Instead of carrying his legacy into a Clinton presidency, Obama has had to stand by largely in silence as Donald Trump has worked to roll back his achievements in health care, civil rights, worker and consumer safety, immigration, education, and environmental protection.

Obama and Biden largely disappeared for the first year and a half of the Trump administration, out of a sense of protocol. When they made a surprise visit to Dog Tag Bakery in Georgetown for lunch on July 30, 2018, the Internet lit up and the media celebrated their reemergence. The headline on the Cosmopolitan website read: “Barack Obama and Joe Biden Went to Lunch Yesterday and It Was Cuter Than Your Last Date.” The New York Daily News took the opportunity to repost a 17-photo retrospective of the pair’s “bromance through the years.”

Yet as Biden pondered another run for president in 2020, the deep complexities of their relationship reemerged. Obama again hesitated to embrace his vice president. Hewing to his steadfast political pragmatism, Obama refrained from an early endorsement, and as other Democratic hopefuls considered, or announced, their bids for 2020, he met with them.

The media characterized Biden as offended by Obama’s chats with these potential candidates. After Obama sat down with Beto O’Rourke, the rising Texas politician who nearly defeated Ted Cruz in their 2018 U.S. Senate race, Vanity Fair reported that Biden was “upset — not specifically by Obama’s conversation with O’Rourke, but by the former president’s willingness to talk to other plausible Democratic contenders while Biden is still deciding whether to run himself.” Although a Biden spokesman vehemently rejected that appraisal, Biden had to accept that he was just one of many in Obama’s sights for 2020.

When Obama said at an event in Hawaii in January 2019 that there was a need for “new blood” in the ranks of leadership, the Hill depicted it as “a blow to Joe Biden.” The paper quoted an unnamed Obama ally describing the deep love the president had for Biden. “But that’s different than giving his brand to him,” this person told the Hill. “He has an incredible soft spot for him. … But he won’t come out and make Biden his candidate. And I think that hurts Joe.”

Biden finally announced his decision to seek the Democratic nomination on April 25. In response, Obama offered through a spokeswoman a milquetoast acknowledgment of his buddy’s contribution to his administration. Perhaps as cover for the lack of anything stronger from the former president, Biden insisted later that day that he had asked Obama not to endorse anyone during the primary season.

If Obama wouldn’t provide a stamp of approval himself, however, Biden was able to dip into the archives of their friendship to create what amounted to a full-throated endorsement in Obama’s own words. After he announced his candidacy, Biden released a campaign ad that showed Obama praising him in language that spoke directly to Biden’s fitness for the presidency. In the slick, masterfully edited video, Obama stands at a lectern in the White House State Dining Room at Biden’s 2017 Medal of Freedom ceremony with the vice president at his shoulder.

“This is an extraordinary man, with an extraordinary career in public service,” Obama says in the video, “somebody who has devoted his entire professional life to service to this country.” The president rattles off Biden’s many accomplishments in the White House and through his career: revitalizing American manufacturing, making college more affordable, fighting for progress in cancer research, leading the campaign against sexual assault, championing landmark legislation to protect women from violence. Over photos of Biden listening to, greeting and hugging Americans, Obama hails Biden’s role in saving autoworkers’ jobs, promoting hope and opportunity for children, sticking up for the little guy, and comforting grieving Gold Star families. “That’s Joe Biden,” Obama says, “resilient, loyal and a patriot.” The video pictures Biden in presidential poses, staring out thoughtfully from the White House colonnade and sitting at Obama’s side in the Situation Room. “Joe’s candid counsel has made me a better president,” Obama says. “He could not have been a more effective partner in the progress that we’ve made. The best part is, he’s nowhere close to finished.”

The ad was a blatant grab at Obama’s coattails, something no other Democratic candidate can do. But Biden has to strike a delicate balance: The best-mate routine can go too far, which became apparent with his posting of the friendship bracelet in June. That gesture brought a storm of Twitter comments, including one from David Axelrod. “This is a joke, right?” he wondered.

The pair eating lunch at Ray’s Hell Burger in Arlington in 2009. (Pete Souza/White House)

What, in the end, should we make of this complicated relationship? It was born of politics — beginning as campaign partnership of two starkly different personalities — and evolved into a profound friendship, the likes of which had never existed between a president and a vice president. And the feelings between Obama and Biden spread beyond the two men. Their families were drawn to each other, too. Biden’s grandchildren and Obama’s children became hanging-out buddies and arranged sleepovers together. Michelle Obama and Jill Biden worked and traveled together on behalf of military families.

“It was oil and water, but oil and water that somehow did come together eventually through the years,” Julie Smith, Biden’s deputy national security adviser, told me. “It could have gone the other way. They could have ended up really angry at each other.”

Whatever strains may have surfaced in the friendship, the White House duo got past them. “Obama and Biden both shared a belief in playing the long game,” observes Liz Allen. Throughout his presidency, Obama tried to keep his eye on the future and not be hindered by the ups and downs of the moment. “And,” Allen told me, “it was the same for the relationship.”

Now, the sweetest years of the friendship are likely behind them. But that doesn’t mean it was all a mirage. Biden has a favorite story, which he told at his Medal of Freedom ceremony in the last days of the administration. Despite being lifted up and knocked down by Obama, he still reveled in the moment they realized their rapport. About six months into the first term, he and Obama were having one of their weekly lunches — just the two of them — in the president’s private dining room when it hit them. As Biden told it, Obama looked at him and said, “You know, Joe. You know what surprised me? How we’ve become such good friends.” Joe, grinning and twinkling, delivered his comeback: “And I said, ‘Surprised you?’ ”

Steven Levingston, the nonfiction books editor of The Washington Post, is the author of “Kennedy and King: The President, the Pastor, and the Battle Over Civil Rights.” This article is adapted from his new book, “Barack and Joe: The Making of an Extraordinary Partnership,” which will be published by Hachette Books on Oct. 8.

Illustration by Michelle Thompson based on photos by Marvin Joseph and Shutterstock. Art direction by Klara Auerbach.