Former Vice President Joe Biden lauded longtime political rival Sen. John McCain as an American hero and friend at an award ceremony Friday at the U.S. Naval Academy in Annapolis, Maryland.

Mr. Biden made the remarks while accepting the Naval Academy Alumni Association’s Distinguished Graduate Award on behalf of Mr. McCain, Arizona Republican, as the six-term senator continues to receive treatment in his home state for glioblastoma, an aggressive form of brain cancer that took the life of Mr. Biden’s son, Beau, in 2015.

Mr. McCain has led a “life of honor, decency, duty and devotion to his country like none other in modern American history,” said Mr. Biden, Cronkite News reported.

“Like my Beau, John has never bent, never bowed and never, ever yielded,” Mr. Biden said. “And he has never given up hope.”

Mr. McCain, 81, graduated from the Naval Academy in 1958. He held the rank of lieutenant commander when he was captured on combat duty in 1967 in North Vietnam, where he spent five years as a prisoner of war subjected to severe torture and solitary confinement.

“How many others, knowing they could go free would subject themselves to five more years of torture because he adhered to the standard, first man in, first man out?” Mr. Biden asked. “I challenge you to find more than a couple handfuls of heroes, that would step up to that standard, to be beaten punished, his bones repeatedly broken.”

Mr. McCain retired from the Navy in 1981 as a captain and subsequently sought elective office, spurring a decades-long political career that earned him the GOP’s nomination for president in 2008 when he campaigned against Democratic winner Barack Obama and his running mate, Mr. Biden.

“John ranks among the very best the academy in my distinction has ever seen,” said Mr. Biden. “John is an American hero who has lifted all of us up, lifted his nation up.

“God bless my friend John McCain,” he said.

Mr. Biden addressed his relationship with Mr. McCain later Friday at an event at Southern Connecticut State University in New Haven.

“He’s a very close friend of mine, and a political opponent, and he’s in tough shape and he asked me to go to Annapolis and speak for him,” Mr. Biden told attendees, The Associated Press reported. “He’s my friend. So of course I went.”

The Distinguished Graduate Award was created in 1998 to honor graduates “who have demonstrated a lifetime commitment to service, personal character and distinguished contributions to our nation,” according to the Naval Academy.