Republican Sen. John McCain says former President Obama called to thank him after his dramatic vote against his party’s Obamacare repeal bill last year.

In a copy of his forthcoming book, “The Restless Wave,” obtained by the Daily Beast, McCain said he appreciated the call from Obama. The two ran against each other in the 2008 presidential election.

“Among the people who called to thank me was President Obama,” McCain writes. “I appreciated the 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.”

Before McCain turned his thumb down to signal his no vote, he received a call from President Trump urging him to support the bill. The call came after Vice President Mike Pence tried to lobby McCain on the Senate floor to vote with their party. Obama didn’t call ahead of the vote to try to sway McCain’s vote, the senator said.

“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.”

McCain’s book is set to be released May 22. The book’s release comes as he battles an aggressive form of brain cancer.