Interested in John McCain?Add John McCain as an interest to stay up to date on the latest John McCain news, video, and analysis from ABC News.
In those behind-the-scenes discussions about policy and family, "Our disagreements didn't go away," Obama said at McCain's funeral service Saturday.
"But we enjoyed the time we shared away from the bright lights. And we laughed with each other. And we learned from each other. And we never doubted the other man's sincerity or the other man's patriotism. Or that when all was said and done, we were on the same team."
"We never doubted we were on the same team," Obama said.
Obama was among three former presidents at Saturday's funeral; President Donald Trump was not invited.
Former President George W. Bush "and I are among the fortunate few who competed against John at the highest levels of politics," said Obama, who ran against McCain in the 2008 presidential election. "He made us better presidents, just as he made the Senate better, just as he made this country better."
Obama described McCain, who died last Saturday of glioblastoma, as "a warrior, a statesman, a patriot who embodied so much that is best in America."
Obama called it an honor that McCain wanted him to speak at his funeral.
The former president said McCain called him with this request earlier this year, and "after our conversation ended, I realized how well it captured some of John's essential qualities."
"John liked being unpredictable," Obama said. "What better way to get a last laugh than to make George and I say nice things about him to a national audience?"
Bush also spoke at the service, calling McCain "honest, no matter whom it offended. Presidents were not spared."
"Back in the day, he could frustrate me," Bush said. "And I know he'd say the same thing about me. But he also made me better."
"Above all, John detested the abuse of power," Bush said. "He could not abide bigots and swaggering despots."
Beyond the eulogies by the former presidents, former Sen. Joe Lieberman also spoke at the service, saying his good friend McCain knew "went to negotiate and compromise to get something done."
"He regularly reached across party lines because he knew that was the only way to solve problems and seize opportunities for the people of our country and his state."
Lieberman praised McCain's memorable response, during the 2008 presidential election, to a constituent who said then-Sen. Obama couldn't be trusted because was an "Arab."
"It was pure reflex," Lieberman said of McCain's reaction. "It was who John was. He didn't need to consult anyone. He immediately defended his opponent's name and honor."
President Donald Trump, who was not invited to Saturday's ceremony at the Washington National Cathedral, was noticeably absent. Former President Bill Clinton and Hillary Clinton, Trump's Democratic opponent in 2016, were also in attendance.
Trump spent Saturday at his private golf club in Sterling, Virginia. The president tweeted Saturday, threatening Congress not to interfere with his renegotiation of NAFTA.
Ivanka Trump and Jared Kushner were both present at Saturday's ceremony, as well as Chief of Staff John Kelly, who accompanied the late senator's wife Cindy McCain to the Vietnam Memorial ahead of the funeral.
Trump came under public pressure to acknowledge the former Vietnam prisoner of war and longtime Arizona senator after initially releasing only a short tweet of condolences and lowering the White House flag for less than 48 hours.
The White House eventually returned the flag to half-staff under pressure from veterans groups and even some of its own staffers.
When asked whether he missed an opportunity to unite the country, Trump stood by his actions, telling Bloomberg News, "No, I don’t think I did at all."
"I’ve done everything that they requested," Trump said.
ABC News' Meghan Keneally and Alex Mallin contributed to this report.