Ethan Miller/Getty

Ted Cruz wants to be the Richard Nixon to Donald Trump’s Barry Goldwater.

In 1964, Nixon saw Goldwater’s doomed presidential bid as an opportunity. He crisscrossed the country in support of Goldwater, not necessarily because he believed in his candidacy, but because he identified Goldwater’s rancid supporters as a powerful base that could propel him to the presidency. In 1968, they did just that.

Cruz is trying to do something similar with Trump. While he’s preparing to run again in 2020, he’s also cozying up to the man who accused his father of having a hand in the Kennedy assassination and tweeted an unflattering picture of his wife, and who Cruz once called a “pathological liar” and “a narcissist at a level I don’t think this country has ever seen before.” While many Republicans are currently distancing themselves from Trump, Cruz is cynically buddying up with him: On Thursday he announced that he will speak at the Republican National Convention, which will take place in Cleveland in mid-July.

Cruz’s gamble is that Trump’s supporters will flock to him in 2020 for his loyalty. But the American electorate in 2020 will look very different than America did in 1968, and that might be Cruz’s undoing—cozying up to Trump could help ensure that he wins the nomination and loses the general election.