Donald Trump and Ted Cruz. Photo: Scott Olson/Getty Images; Daniel Acker/Bloomberg via Getty Images

Of all of the curiosities this presidential campaign has produced so far, add to the list a joint-candidate rally featuring two of the most polarizing candidates in the GOP. On Thursday, Ted Cruz announced that Donald Trump would join him at the Capitol next month to protest lawmakers supporting the Iranian nuclear deal. “Glad @realdonaldtrump accepted my invitation to rally in DC to stop the catastrophic #IranDeal,” Cruz tweeted from his campaign account.

Glad @realdonaldtrump accepted my invitation to rally in DC to stop the catastrophic #IranDeal. http://t.co/0Sls2l3b6h — Ted Cruz (@tedcruz) August 27, 2015

It was the surest sign yet that Cruz’s apparent strategy of wooing the controversial candidate — and positioning himself to win over Trump supporters if (or when) the businessman flames out of the race — is starting to pay off.

However Trump’s magic-carpet ride through GOP primary season ends, it will be remembered for (among other things) just how ill-prepared his fellow candidates were to take him on. Jeb Bush tried this week, in his characteristically genteel way, to respond to the insults that Trump has been hurling at him like spitballs all summer: “There’s a difference between Donald Trump and me: I’m a proven conservative with a record,” he told a gaggle of reporters last week with his hands clasped uncomfortably in front of him. Trump, not just undeterred but energized by the reaction, told the New York Times that Bush was a “low-energy person” — a phrase he’s repeated several times, knowing that it tweaks the younger Bush brother — and took to Twitter to mock him for rarely using his last name. Scott Walker has tried to ignore him, refusing to answer whether or not he supports birthright citizenship and declaring himself “unintimidated” so often it’s hard to believe him. But the Donald’s diatribes have caused him to slip in the polls, too.

Not so with Ted Cruz, who may be the only top-tier candidate willing to embrace Trump. Yes — Ted Cruz is a top-tier candidate — even though he’s been more or less ignored by the rest of the field since he launched his campaign back in March. The most important poll numbers right now come from Iowa: They’re the first state to caucus, and the momentum a candidate is able to pick up there will be important in determining who moves forward in the race. In Iowa, Cruz is averaging fourth place in polls. (He’s running fifth in the national poll averages.) In the last fund-raising quarter, only Jeb Bush out-raised him in the Republican field.

A key part of Cruz’s gambit seems to be maintaining friendly personal relations with Trump. While everyone else is busy dodging, ignoring, or attacking him, Cruz has welcomed the Donald with open arms. “I am proud to stand with Donald Trump,” Cruz recently told one of his TV interviewers. “I like him and respect him.” They’ve managed to keep it positive even though both are famously unfriendly with the other figureheads in their party, and even though Trump raised the uncomfortable fact that Cruz was born in Canada when he launched his campaign back in March. The affection goes beyond publicly stated admiration, too: As the Daily Beast’s Tim Mak reported, Trump and Cruz have met up at least five times and continue to keep the back channels open between campaigns. Trump’s madcap trip to the border was almost a joint press event, but Cruz had a scheduling conflict get in the way. Cruz is now trying out the unusual Trump strategy of attacking one of the right’s most beloved journalists, Megyn Kelly. On Tuesday, he responded to Kelly’s line of questioning about how he’d deport undocumented families with an attack: “Megyn, I get that that’s the question you want to ask,” he said when Kelly pressed him. “That’s also the question every mainstream-media liberal journalist wants to ask.”

But for Cruz this is all part of a bigger strategy and a longer game. He’s been working to secure the same voter base as Trump since being elected to the Senate in 2012 — the base of voters who hate the political Establishment so much that being a villain to Democrats and Republicans alike is the entire point. It’s the strategy that motivated his publicity-raising faux filibusters, his efforts to lead a government shutdown, and his most bombastic public statements.

Trump’s temporary advantage over Cruz is that he’s leveraging a well-established and decades-old public persona to appeal to many of the same voters, and he’s doing it in a wildly entertaining (and fact-free) way. But in the long run Trump’s strategy can’t work: Winning a fifth of the GOP primary electorate and actually being able to win the general election are two very different things, especially if the candidate has shown no allegiance to the party he’s trying to represent, as Jonathan Chait points out.

Cruz surely knows that Trump isn’t built to last, and when Trump finally exits the race, Cruz will be there to pick up his base. Unlike Trump, Cruz is a real conservative — and it’s not inconceivable that he could win the primary. While the rest of the party spends the fall trying to tear Trump down, you can be sure Cruz will keep up the good relations, all while raising millions of dollars behind the scenes and preparing for the inevitable moment Trump exits the race. If the rest of the Republican field isn’t worried about Cruz yet, they should be.