Former President Obama thanked Sen. John McCain John Sidney McCainCindy McCain endorses Biden: He's only candidate 'who stands up for our values' Biden says Cindy McCain will endorse him Biden's six best bets in 2016 Trump states MORE (R-Ariz.) last year after he voted against the GOP effort to repeal ObamaCare, according to the senator's upcoming memoir.

“Among the people who called to thank me was President Obama,” McCain writes in "The Restless Wave," according to the Daily Beast.

ADVERTISEMENT

“I appreciated his call, but, as I said, my purpose hadn’t been to preserve his signature accomplishment but to insist on a better alternative, and to give the Senate an opportunity to work together to find one,” he continued.

“He hadn’t called to lobby me before the vote, which I had appreciated. He had last called me not long after the November election, during the transition to the Trump administration, to congratulate me on my reelection. He added that he was counting on me to be an outspoken and independent voice for the causes I believed in as I had been during his presidency. I thanked him, and said I would try to be.”

Obama and McCain faced off against each other in the 2008 presidential election, but have since formed a cordial relationship.

Reports surfaced last week that Obama and former President George W. Bush are expected to eulogize McCain, who is battling brain cancer, at his funeral.

McCain was one of three Republican senators who broke with the party in July, appearing on the Senate floor during an early morning session to vote down efforts to repeal Obama's signature presidential achievement.

McCain earned praise from Democrats, including Senate Majority Leader Charles Schumer (D-N.Y.), for the move, but also faced the ire of President Trump Donald John TrumpOmar fires back at Trump over rally remarks: 'This is my country' Pelosi: Trump hurrying to fill SCOTUS seat so he can repeal ObamaCare Trump mocks Biden appearance, mask use ahead of first debate MORE.

The president called out McCain for the move earlier this year but did not use his name.

"Except for one senator, who came into a room at 3 o’clock in the morning and went like that, we would have had health care, too ... think of that," Trump said.