In a surprise plot twist, President Trump’s new tax law is delivering many of its juiciest benefits to his most vocal critics in Hollywood.

The tax overhaul doles out windfalls to the producers and film financiers who control the entertainment industry.

It slashes tax rates, especially on overseas profits, and changes accounting rules in a way that could attract more investment dollars. With clever planning, A-list celebrities and directors could also benefit, especially by using a break intended for business owners.

“It is going to be very encouraging for people who risk money making movies,” said Michael R. Morris, a tax lawyer in L.A. and a former Internal Revenue Service trial attorney.

Trump has said middle-class Americans will be the biggest beneficiaries under the $1.5-trillion tax cut. But in Hollywood, the opposite is playing out. It’s the struggling performers and behind-the-scenes workers who could get squeezed.

Sandra Karas, an actor and tax attorney, has been touring the country for the Actors’ Equity union to warn members about one change for working- and middle-class performers: the elimination of deductions for work-related expenses such as union dues and payments to agents who line up jobs.

Those write-offs have been crucial for actors who are often considered employees for their gigs, even if they’re temporary. Top earners in Hollywood are almost always independent contractors or owners of so-called pass-through entities; both will still be able to deduct those expenses.

“The money is moving up to the top, and it’s not going to go back down to the little guy anytime soon,” Karas said.

Hollywood’s hostility to Trump was apparent during the 2016 election, when the industry made $85 million in political donations and sent 84% of its individual candidate donations to Democrats, according to the Center for Responsive Politics.

Still, those donations don’t mean the industry’s lobbying groups were absent as Republican lawmakers were crafting the bill, which passed in December.

The big studios such as Walt Disney Co., Viacom Inc., Warner Bros. Entertainment Inc. and NBCUniversal Inc. will benefit from the new corporate tax rate of 21%. Most of the studios’ owners, including Disney and Comcast Corp., previously paid effective tax rates above 30%.

Beyond that, the Motion Picture Assn. of America successfully pushed for the industry to be able to immediately write off the costs of large U.S.-made film and TV projects.

Under the old rules, producers could deduct the costs of large projects only gradually over the many years that they typically bring in revenue.

Under the new tax law, total production costs can be deducted as soon as a new product is released to the public. The benefit is set to phase out starting in 2023.

Another change allows owners of U.S. content to pay an ultra-low tax rate, about 13%, on foreign income. Film and TV were responsible for $16.5 billion in exports in 2016, according to the MPAA.

“Studios just got a big windfall,” said Schuyler Moore, a partner at law firm Greenberg Glusker.