Apple (NASDAQ:AAPL) stock is (so far) finishing 2019 on a high note, and it doesn't necessarily have a new iPhone or streaming service launch to thank for the rise.

It does have a chief executive who has been able to steer the tech company through a protracted U.S. trade war with China relatively unscathed. The main reason: CEO Tim Cook's working relationship with the White House.

At a time when executives like Amazon's (NASDAQ:AMZN) Jeff Bezos are criticizing President Trump, Cook has taken a different approach. He has befriended the president, reaching out when Apple needs help. Cook also sits on Trump's Workforce Policy Advisory Board and in late November gave the president a tour of an Apple manufacturing plant in Texas.

Boot with a U.S. flag on its side about to step on miniature electronic and household goods in a box labeled Made in China.

Source image: Getty Images.

Cook's Trump courtship serves Apple investors well 

The openly gay CEO, who is openly at odds with the president on immigration and climate change issues, still has Trump's ear and has so far successfully made the case about why policies such as U.S. tariffs will have a negative impact on Apple's business. It was reportedly during a private dinner with Trump in August that Cook explained why Apple should be exempt from tariffs. Trump told reporters following the dinner that Apple laid out a "good case."

That's in stark contrast to Amazon's Bezos, who also owns The Washington Post. His company has gone as far as to threaten to sue the Trump administration for losing out on a huge $10 billion, 10-year Pentagon cloud computing contract, claiming political bias.

The relationship with Trump has served Apple investors well over the years. Thanks to Trump's tax bill in 2017, Apple repatriated $238 billion, saving billions in taxes. Its stock is up 80% since January when shares tanked after it issued a rare warning of an earnings miss in the just-completed holiday quarter. Apple blamed its business efforts in China for the miss.

Since then, investors have renewed confidence in Apple, in big part because of how Cook has expertly navigated the trade war with China. While investors care about the latest iteration of the iPhone, they understand the impact tariffs can have on its bottom line and reward Apple when it makes progress in avoiding the additional tax that a tariff imposes.

Apple employees appear to have Cook's back 

China is a big market for Apple. It reported $11.1 billion in sales from that region in its most recently reported fourth quarter.

Apple's iPhones and iPads are assembled in China, and it relies on the country for many of the components that go into its computers and devices.

If it is subjected to tariffs, it will have to shoulder the increased costs or pass them on to consumers in the form of higher prices. Either option could dent profits, which were up 4% in the fourth quarter, and gross margin, which was 38%. It's the reason the stock moves when there are developments in trade talks between the two countries. Apple's stock hit an all-time high in October after Trump said the U.S. and China were making progress on trade talks.

A similar fate was bestowed Apple's shares after Trump's late November tour of an Austin, Texas, Apple plant that produces its Mac Pro computer. The plant will continue to churn out computers after the White House agreed in September to waive tariffs on Chinese-made computer parts Apple needs for its U.S. production. During a press conference following the tour, Trump said Apple could be exempt from Chinese tariffs that have been delayed, sending the stock surging yet again. "The problem we have is you have Samsung -- it's a great company, but it's a competitor of Apple, and it's not fair if -- because we have a trade deal with Korea. We made a great trade deal with South Korea, but we have to treat Apple on a somewhat similar basis as we treat Samsung," Trump said.

Investors are not the only ones who support Cook's relationship with Trump. A poll commissioned by Fortune and conducted by workplace social network Blinds found 81.6% of Apple workers back Cook's efforts to work with Trump on issues and policies that could impact the company. The majority also think it's fair if some of Apple's products are exempt from tariffs. That employees have Cook's back is reassuring to investors who worry about the impact employee backlash against the controversial president can have on its reputation.

The stakes are higher than ever

Cook's relationship with President Trump is being put to its biggest test as tariffs on an additional $160 billion in products coming from China are scheduled to go into effect on Dec. 15. If the U.S. and China don't reach a deal, consumer goods like iPhones could be included in the fresh round of targeted products. 

Apple is working to prevent that from happening. In addition to building a relationship with the president himself, Apple recently hired Jeffrey Miller, a Trump ally and vice finance chairman for Trump's inaugural committee, to lobby for the company. Apple disclosed in a lobbying registration form that Apple is also hiring others close to the Trump White House to be its voice when it comes to trade issues related to technology. It underscores the precarious position Apple remains in. If iPhones are affected by tariffs, it could tank the stock. But if Apple gets the exclusion Cook has been working so hard to receive, the iPhone maker may end the year on an even stronger note. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.