As investors, we've all been right many times, and wrong many times. Sometimes developments you couldn't plausibly predict take a great company and send its stock price plunging -- and sometimes the opposite happens.

With that said, one of the most frustrating things as an investor is when your thesis proves to be correct, yet the market refuses to acknowledge the company's success, leaving its stock price in neutral -- or worse. That's exactly what's happening with these two great companies the market loves to hate.


Ford's 2017 F-150 Raptor. Image source: Ford Motor Company.

First up: Ford Motor Company (F 0.66%)
The folks over at the Blue Oval in Dearborn, Mich., are doing so many things right, it's difficult to keep count. Ford's market share continues to move higher in China -- the world's largest automotive market, and one Ford was late to enter -- and the company set a record high sales last year, reaching 1.1 million vehicles. Ford's also turning the corner in Europe, where the company has lost roughly $4.6 billion since the beginning of 2012, and posted its best sales volume since 2011 last year. This should be the year Ford finally breaks even in Europe, and when the region begins to drop earnings to the company's bottom line, it will be a nice boost. Here in the U.S., Ford continues to churn out the profits driven by America's best-selling vehicle, the F-Series. The full-size truck hauls mega profits for Ford, and its switch to aluminum body panels was risky, but it has been a hit with critics and consumers.

When you combine all those factors, you get a very profitable automaker; in fact, Ford expects to record a record year for pre-tax profits when the book is closed on 2015. Ford even rewarded its shareholders when it recently declared a $1 billion supplemental cash dividend -- or $0.25 per share – on top of its first-quarter regular dividend of $0.15 per share.

While Ford's current success is being driven by full-size trucks and SUVs, the company is much more forward-looking than the market gives it credit for. Ford's spending $4.5 billion to fund the introduction of 13 new "electrified vehicles" to the company's vehicle product portfolio by the end of this decade. That means more than 40% of Ford's global nameplates will be electrified in some way by the end of the decade, a hefty increase from today's 13% mark.

F Chart
F data by YCharts.

Despite record profits, surging popularity with its new vehicle designs, and preparing to adapt to an electric vehicle future, the market has consistently sent Ford's stock price lower thanks to the doom and gloom of "peak auto sales."

Next up: Canadian National Railway Co (CNI 0.39%)
It's not too surprising that the railroad industry checked in with a poor 2015 as volumes of coal and other commodities slumped. Despite those headwinds likely remaining for the near term, there are still many positives when looking at railroad companies.

More specifically, about 40% of freight in the U.S. is transported by railroads -- more than trucks, ships, or pipelines. Railroads also have a pricing power edge over their main competitor, the trucking industry. That's simply because there are fewer railroads competing, which equates to less competitive pricing and more sustainable profitability.

Canadian National Railway has certainly been an unloved stock over the past year, declining by roughly 20%, but that hasn't stopped the company from producing solid results. Looking at third-quarter results, it's clear that the company is improving its operations in just about every way possible.


Image source: Canadian National Railway's third-quarter presentation.

In fact, CN's operating ratio was a quarterly record 53.8% in the third quarter, and the railroad continues to lead the industry in margins. And thanks to weakness in coal, grain, and energy markets, CN's carloads dropped 6% during the third quarter, yet it's top-line revenue rose 3% thanks to a 9% gain in $-per-carload.

Further, CN's net income rose 18% during the third quarter, compared to the prior year, and its diluted earnings-per-share checked in 21% higher during the same time period. It also generated $1.7 billion free cash flow during the third quarter, which is a solid performance.

On top of its strong quarterly earnings, CN announced a new share buyback and increased its dividend by 25% last year. Despite the market loving to hate CN, it continues to be a standout in the railroad industry and will eventually reward shareholders.