U.S. President Donald Trump is so fond of British Prime Minister Boris Johnson that he gave him his private cell phone number. The British pol, meanwhile, has praised Trump and cultivated Trump aides such as Stephen Miller, whom he’s privately met and offered writing tips.

But over the past few weeks, Trump and Johnson have pretended they barely know each other, calculating that a public embrace could hurt Johnson in Thursday’s elections in Britain, where Trump is deeply unpopular. Johnson was even caught on camera laughing as other world leaders mocked Trump.

Now, it appears the pair can stop the pretense.

An exit poll released as the voting ended predicted that Johnson’s Conservative Party would win a majority in Parliament, defeating the Labour Party of socialist-leaning Jeremy Corbyn. The British prime minister hopes he can now push through his Brexit deal with the European Union and pave the way for a trade deal with the United States.

For Trump, a Johnson win means he can stop with the unusual restraint he’s shown and once again flaunt his relationship with a foreign leader he's described as a "really good man" and "Britain Trump."

Some observers argue that Trump might even see a Johnson win as a good harbinger for his own fortunes in the 2020 U.S. presidential race, as he did after the 2016 British referendum on European Union membership.

“I think [Trump] sees that when leaders that act and talk like him win, that he’ll see it as a proxy for him,” said Heather Conley, who served in the State Department’s Europe division during the George W. Bush administration.

Much has been made of Trump and Johnson’s superficial similarities: Both have flamboyant blonde hairstyles, rail against political correctness, are slippery with the truth, sound populist themes, and are willing to buck the establishment for political gain — in Johnson’s case, for instance, he broke with his party's leaders to back Brexit.

But Johnson, a product of Eton and Oxford, is a creature of the upper crust of British society; Trump has carried his outer-borough resentment of social elites into the White House. Despite his support for leaving the European Union, Johnson believes in multilateral alliances such as NATO, while Trump has called the transatlantic grouping "obsolete" and has even reportedly threatened to leave it.

In fact, during the 2016 U.S. presidential campaign, Johnson had harsh words for Trump.

From his perch as the mayor of London, Johnson ripped Trump’s proposal to bar Muslims from the U.S. and criticized his claims that there were Muslim-heavy no-go zones in the British capital. He described Trump as “clearly out of his mind,” “unfit” for office and a purveyor of “stupefying ignorance.”

“I would invite him to come and see the whole of London and take him 'round the city, except I wouldn’t want to expose any Londoners to any unnecessary risk of meeting Donald Trump," Johnson said at one point, according to media accounts at the time.

Johnson changed his tune after Trump won in November 2016.

By then the foreign secretary, Johnson met with the president-elect's advisers in January 2017, and went on to praise Trump's “exciting agenda for change.” Later that year, Johnson and Trump shook hands and talked during the U.N. General Assembly.

According to a former White House official, Johnson — who even then was widely believed to be eyeing the role of prime minister — realized quickly that the best way to get to Trump was through his top aides. He fixated in particular on White House senior policy adviser and Trump favorite Stephen Miller, the anti-immigration firebrand who also has a major role in writing many of the president’s speeches.

Johnson, a former newspaper columnist known for his bilbo-like wit, magniloquent oratory and looseness with facts, appealed to Miller’s desire to improve his own craft. Former British pol Nick Clegg once called Johnson "Trump with a thesaurus."

“There were a few times when Boris Johnson would just come and meet, somewhat surreptitiously, with Stephen Miller and vice versa,” the former White House official said. Miller said he and Johnson swapped speech-writing ideas and tips with each other, according to the former official.

The Miller-Johnson meetings, often held off the White House grounds, were kept quiet, the former official said, because they may have alarmed then-British Prime Minister Theresa May, whose relations with Trump were strained.

They also may have been a way for Johnson to raise his profile with Trump at a time when the U.S. president appeared to dote on another British pol, Nigel Farage. Farage, a long-time Brexit promoter who is something of a rival to Johnson, met with Trump during the transition and swam in many of the same right-wing circles as former Trump adviser Steve Bannon.

“What I think happened is that Stephen Miller talked him up” to Trump, the former official said of Johnson.

A Trump administration official said that Johnson and Trump talk roughly once every other week now. “They’re buddies,” the official said. “Probably his closest relationship.”

One reason Trump likes Johnson so much, a former U.S. government official said, is that Johnson isn’t May, whom Trump “loathes.” Trump often injected himself into British politics during May’s tenure, criticizing her handling of Brexit and even saying her rival Johnson would make a good prime minister.

“He thought she was weak,” said the former U.S. government official, who confirmed that Trump gave Johnson his private number. “If you had become the British prime minister, he probably would have given you his personal cell phone number, too, just because he was so relieved to not deal with Theresa May anymore.”

Trump hasn’t appeared, at least not in public, to be upset at Johnson for being among the world leaders who were caught on camera mocking him during the NATO gathering earlier this month. Administration officials said Trump has pinned the blame for that kerfuffle on Canadian Prime Minister Justin Trudeau, whom he called “two-faced.”

An aide to Johnson did not respond to a request for comment.

It is possible that Trump isn’t aware of Johnson’s past criticisms of him, or has forgotten them. But it’s also possible the president is cognizant of the political opportunism that drives the British leader, and is willing to go along with Johnson's changing tone to burnish his own political fortunes, people close to Trump say.

A person close to the British government countered that Johnson and his aides are aware that Trump “can turn in a second on anyone and are prepared for that.”

Other leaders have tried to forge strong personal ties with Trump; almost none have gotten much out of it.

French President Emmanuel Macron, who feted Trump with a Bastille Day parade and dinner in the Eiffel Tower, pleaded with his American counterpart to stay in the Iran nuclear deal; he didn’t.

Japanese Prime Minister Shinzo Abe rushed to Trump Tower in New York to be the first foreign leader to embrace Trump, then tried to reach understandings on trade and North Korea; Trump slapped tariffs on Japanese steel and aluminum and has shrugged off North Korean missile tests while sidling up to North Korean dictator Kim Jong Un.

Johnson and Trump have their policy differences, too. For example, Johnson supports the Iran nuclear deal and the Paris climate agreement; Trump withdrew from the first and has taken steps to leave the second. Earlier this year, Johnson said "the answer is no" when asked if he would support U.S. military strikes on Iran.

“On policy grounds, [Johnson is] a lot closer to the continental Europeans than he is to Trump. That’s the irony,” said Tom Wright, a foreign policy analyst at the Brookings Institution.

For political and economic reasons, both Johnson and Trump have an interest in securing a U.S.-U.K. trade deal if and when the U.K.’s divorce from the European Union becomes final. Some U.S. officials and analysts expect that a solid Johnson win Thursday could “liberate” the two in preparing for future bilateral trade talks.

Once Brexit is complete, Johnson is likely to pursue both a new British-E.U. trade arrangement as well as a deal with the United States. He’ll have different sorts of leverage for each.

When dealing with the EU, he may be able to point to the courtship from the U.S. as a way of pushing for more favorable terms. When dealing with the U.S., he can point to EU regulations, which the Trump team often doesn’t like, as a way to explain his own positioning on various trade standards.

It will be a tricky balancing act, said Amanda Sloat, a “Brexpert” with the Brookings Institution. That’s become obvious as U.S. representatives, including Trump, have made it clear they won’t take it easy on the British during any talks.

“He wants Trump's continued support for a trade deal, but will confront challenging U.S. demands on things like agriculture standards and pharmaceutical pricing,” she said.

The Trump administration also is coming down hard on Britain to end ties with Chinese telecommunications firm Huawei. Secretary of State Mike Pompeo has even hinted that the issue could damage tight U.S.-U.K. intelligence ties.

Johnson won’t be able to avoid a decision on that, analysts predicted. In fact, “Trump may believe that Johnson owes him something for staying out of the election,” Wright said.

Neither Johnson nor his lead competitor, Corbyn, are particularly well-liked by British voters, many of whom are holding their noses as they cast ballots Thursday. Johnson's margin of victory may not be large enough for him to afford him much room to maneuver.

Still, some analysts noted that political trends in Europe often seem to forecast events in the United States. Rising populist sentiment, hostility toward migration and leaders with an authoritarian bent were present in Europe ahead of the Trump wave in America. Trump's election came months after the stunning, and close, British referendum to quit the EU.

If Johnson triumphs, said Derek Chollet of the German Marshall Fund, "Trump will absolutely see this as a vindication of him in a way because his guy won."