WASHINGTON — President Joe Biden has long believed diplomacy is about personal relationships — and he’ll spend Friday in Berlin with German Chancellor Olaf Scholz as his time in office is on the cusp of ending.

There is also a planned meeting with other leaders in the “European Quad,” a group that in addition to Biden and Scholz includes French President Emmanuel Macron and British Prime Minister Keir Starmer.

White House press secretary Karine Jean-Pierre noted Biden has a “close relationship” with Scholz, who early this year helped broker a multicountry prisoner swap that brought back to the United States the journalist Evan Gershkovich and former Marine Paul Whelan. The German leader told Biden before the deal in words to the effect, “For you, I will do this.”

But Biden’s whirlwind trip in which he arrived Thursday evening is hardly just a social visit.

The U.S. and Germany have been the largest two sources of aid to Ukraine as it fights to repel a Russian invasion. And with less than three weeks before the U.S. presidential election, Biden also feels obligated to ready allies for the possible return to the White House of Republican Donald Trump, who has antagonized U.S. friends while displaying an appreciation for Russian President Vladimir Putin.

In addition to Ukraine, Biden and Scholz plan to discuss European Union relations, democratic values, trade and technology issues, global supply chains, tensions in the Middle East and security issues in the Indo-Pacific region. While in Germany, Biden will also meet with its president, Frank-Walter Steinmeier.

Earlier this month, Biden delayed a trip to Germany and Angola to oversee relief efforts ahead of Hurricane Milton making landfall in Florida. He now plans to go to Angola in December.

His trip to Germany comes as Vice President Kamala Harris, the Democratic nominee, has entered an aggressive sprint to turn out voters in an election that could ultimately determine the future of Biden’s legacy of having strengthened NATO and built up relations in Asia to counter China’s influence.

Trump has questioned America’s commitment to defending NATO allies who are attacked, something that Biden called “un-American” in February.

Trump has also talked about applying tariffs on imports from U.S. allies in Europe and Asia, which could potentially strain relations with countries that could counter Russia, China and other rivals.

“Our allies have taken advantage of us more so than our enemies,” Trump said Tuesday at the Economic Club of Chicago.

Bob Woodward in his new book, “War,” reported that Trump and Putin have spoken seven times.

Trump declined to say whether he’s continued to speak with Putin since losing the 2020 election. “But I will tell you that if I did, it’s a smart thing,” he said. “If I’m friendly with people, if I can have a relationship with people, that’s a good thing and not a bad thing in terms of a country.”