The autocratic regimes in Beijing and Tehran are feeling the heat from Washington. The former is locked in a bitter, damaging trade war with the United States; the latter has seen its country’s economy mauled by sanctions reimposed by the Trump administration after it broke from the 2015 nuclear deal between Iran and world powers. But the tariffs and sanctions have yet to yield President Trump the acquiescence from both parties he seeks. And recent developments suggest these two putative American adversaries may be finding greater common cause.

Last week, Iranian Foreign Minister Mohammad Javad Zarif acknowledged in a parliamentary session that his government is, “with confidence and conviction,” in negotiations with China over a 25-year strategic partnership that could involve about $400 billion in Chinese investment through various sectors of the Iranian economy. An outline of the accord’s details surfaced in an 18-page leaked document online, whose provenance is unclear though it roughly aligns with mooted plans previously announced by the Iranian government. According to the New York Times, a version of the document dated in June that its reporters obtained is a draft of a pending agreement with China.

Even though it has been in the works since 2016, before Trump was elected, the timing of this potential agreement is conspicuous. It’s a reminder of how unlikely it was that Trump could cajole Tehran to sit down for new negotiations after scrapping U.S. commitments to the nuclear deal, a diplomatic agreement that was years in the making and involved the efforts of major powers, including China. Now, with their economy in tatters, the Iranians are seeking a lifeline from Beijing. And Chinese officials, given their own tussle with Washington, seem willing to take the risk.