With fully autonomous vehicles expected to hit the road by 2020, automobile manufacturers and ride-hailing rivals have become unlikely allies.

The common bond is a vision of a driverless ride-hailing future, in which margins rise for ride-hailing companies and automotive companies avoid destruction as consumer sales drop.

“They’re being driven together by common risk,” said Max Wolff, chief economist at Manhattan Venture Partners.

These partnerships are up against well-known technology companies with more in-house artificial-intelligence knowledge and data, but some think the winner will come down to whomever has the biggest consumer brand.

By the year 2030, global car sales are “basically going to fall off a cliff,” said Tasha Keeney, an industrial innovation analyst at ARK Investment Management. Meanwhile, Uber Technologies Inc. and Lyft Inc. are in the midst of class-action lawsuits with drivers who argue they are employees, not independent contractors, which would force the companies to pay for benefits.

Also see: Didi Chuxing reaches deal to buy Uber’s China operations

That means pairing up could save both money, said Paul Boyd, managing partner of ClearPath Capital Partners. A driverless infrastructure could be of particular interest to Uber as it seeks greater profitability.

“If they can eliminate that, then their margins go way up,” Boyd said

At the center of the autonomous future, Lyft, Volvo, Uber, Alphabet Inc. GOOG, -2.37% GOOGL, -2.41% and Ford Motor Co. F, -0.68% are all part of a self-driving coalition, formed in April, and will collectively lobby law makers around autonomous infrastructure.

Outside of that group, individual companies have siphoned off into a complicated web of pairings and investments. Lyft Inc. began the trend in January with a $500 million investment from General Motors, which also invested in ride-hailing companies Sidecar and Cruise, with the stated goal of forming an “autonomous on-demand network.”

Uber followed that with a recent partnership with and investment from Toyota to create “in-car apps,” but it also counts Microsoft Corp. MSFT, -1.24% , a partner with Volvo, as an investor.

“(Ride-hailing companies and manufacturers are) both afraid of the big boys of tech showing up,” Wolff said.

The “big boys” include Alphabet’s Google, which Keeney theorizes has the most advanced system in terms of self-driving capability, given the detailed data it is collecting using Lidar, a technology that measures distance using pulses of light. Data collection is a key component in the development of driverless cars, she said.

Also read: 21 million self-driving cars will be sold in 2035

With semiautonomous vehicles already on the market, Tesla Motors Inc. TSLA, +4.42% is collecting a large data set from its customers and has advanced technology that allows wireless software updates. This makes Tesla, one of the more siloed members of the group, one of the front-runners, Keeney said.

Tesla’s position may be more uncertain after a fatal crash in which the owner had autopilot engaged and a resulting federal investigation of its ”Autopilot” feature, however.

Apple Inc. AAPL, -3.17% lags behind both Google and Tesla in terms of test cars, she said, and will have to develop more artificial intelligence talent. “I think they’re pretty behind,” Keeney said.

Still, based on the idea that autonomous-driving infrastructure is made up of three parts—the actual cars, the technology and the consumer brand—several companies could have the fleets and the technology needed, said Scott Stanford, managing director at Sherpa Ventures. That is when ride-hailing brands like Uber and Lyft, as well as Google, come back into play.

“I think the competitive advantage lies in the consumer brand,” Stanford said.

Also see: Why self-driving cars will probably still have steering wheels

In a sense, Apple has the Lyft consumer brand as well through its $1 billion investment in Didi Chuxing. Didi is part of an international coalition involving Lyft and has invested in the startup.

Apple’s link to Lyft through its investment in Didi is just one example of how complicated this web of partnerships has become. It likely will get even more complicated as the age of driverless ride-hailing approaches.

“I think there will be more partnerships coming,” Boyd said.