Theresa May has found an unlikely source of inspiration for her Brexit plans: Jack Ma, the charismatic billionaire founder of Alibaba Group, the Chinese e-commerce giant, and one of the world’s richest men.

The British premier met Ma, whose net worth is valued at $45.5 billion, at the World Economic Forum in Davos in January and again in Shanghai last week, and the pair got on extremely well, according to two senior British officials. May was hugely impressed by Ma’s account of how he navigates strict Chinese customs rules to import and export goods, they said.

The government is now also studying Amazon.com Inc. to learn more about how the world’s biggest online trading platforms navigate the complexities of international rules while providing a smooth service for customers, a third senior official said. A spokesman for May’s office didn’t have an immediate comment and Alibaba declined to comment.

It’s likely that officials will want to study the Cainiao logistics business used by Alibaba, which provides same-day delivery services in China and also out of the country, despite many border clearance requirements. Cainiao itself doesn’t deliver goods directly to customers. The company runs a data platform that tracks goods in real-time and orchestrates deliveries by about 2 million people across more than 600 cities.

Irish Border

May is particularly keen to understand how Alibaba and Amazon serve their customers because Brexit potentially poses a major problem for cross-border trade.

It’s not just that burdensome tariffs and rules-of-origin checks may be needed on goods traded across the British border after Brexit. The prospect of a deal could fall apart if May and the EU cannot agree a way to avoid setting up a new “hard” customs border between the U.K. and Ireland after Brexit.

The open flow of traffic across the border is a key symbol of peace on the island of Ireland, which both the EU and U.K. are committed to maintaining.

British and Irish officials are trying to come up with a way to protect trade standards and avoid erecting checkpoints on the border between the Republic of Ireland and Northern Ireland. Despite months of effort, and political will on all sides to find a solution, no way forward has yet been reached.

The British government is attracted to technological solutions, under which clearance forms and checks can be completed away from the border. Another option, proposed by the EU side but rejected by May, would be to keep Northern Ireland within the EU’s customs union.

Amazon

Speaking on condition of anonymity, because the discussions aren’t public, two officials said May is now convinced that companies like Alibaba and Amazon might help Britain find the answer through the way they use technology to speed the flow of goods across national frontiers. British officials are studying how Amazon helps small U.K. business export to countries with restrictive customs rules.

After meeting Ma, the prime minister commented in private that if it’s possible to trade across the border into China so easily, it must be possible to design a system that will work for Britain after Brexit, according to two officials.

Alibaba helped drive a free trade deal between China and Malaysia but it’s possible that Ma’s love-in with May won’t last. He told French President Emmanuel Macron he wants to build a logistics center in France.