This year has been one for the history books. Inflation is the highest in 40 years, and stocks got off to their worst first half in over 50 years. The Federal Reserve is raising interest rates to fight inflation, which has many experts concerned that a recession could be on the horizon.

During times like this, it's best to invest in companies with solid businesses that generate good cash flows and can do well even if the economy slows. Here's one firm that has weathered several economic storms over decades, only to come out stronger on the other side.

People have a conversation in an open office setting.

Image source: Getty Images.

Helping clients navigate a changing world

Marsh & McLennan (MMC -0.19%) advises companies on various strategic and workplace issues. The company has two operating segments. Risk and insurance services account for over 60% of its total revenue, and consulting accounts for the remainder.

Through risk and insurance, Marsh & McLennan advises companies on managing risk and connects them to insurers to help them mitigate those risks. Through consulting, the company advises companies on various issues, including compensation and benefits, retirement plans, environmental hazards, and dealing with challenging market conditions like inflation.

The company has done a solid job of increasing earnings, and over the last decade, revenue has grown at 6% compounded annually while net income has grown at 13% compounded annually. It has also increased its free cash flow, or cash left over after paying operating expenses and capital expenditures, by 7% compounded annually.

MMC Revenue (TTM) Chart.

MMC Revenue (TTM) data by YCharts.

Demand for its services is robust

Marsh & McLennan put up a solid second quarter when it announced earnings earlier this month. Revenue increased 7% from the same quarter last year while earnings per share (EPS) grew 19%.  

The company has benefited from a few tailwinds. For one, the pricing conditions for insurers have been firm, meaning insurers have raised prices on customers without harming customer retention too much. According to the Marsh Global Insurance Market Index, insurance prices increased 9% from last year, and insurers have increased rates for the 19th quarter in a row. This is good for Marsh & McLennan because it makes money on commissions paid out of premiums that insurers or reinsurers charge clients for coverage.

It has also benefited from strong demand for its services as companies navigate an uncertain future. Dan Glaser, Marsh & McLennan's president and chief executive officer, told investors, "when the world is unsettled, demand for our services rises." Clients have sought out Marsh & McLennan's expertise to help them deal with challenges from inflationary pressures, supply chain issues, capital markets volatility, and geopolitical risks in recent years.

What to watch for

One concern on investors' minds is the prospect of a recession this year or in 2023. One area of Marsh & McLennan's business that could struggle in a recession is the consulting segment, where clients may cut costs in a downturn. At the moment, the company has said that the pipelines for its consulting services remain strong.

Even so, the company is well positioned for a recession because of the range of services that generate revenue. According to Glaser, the company has grown its EPS during recessionary periods since 1962, making it a solid investment to hold through market cycles.  

The firm's dividend yield is 1.5%, and it recently raised its quarterly payout -- marking the 13th consecutive year of dividend increases. Given Marsh & McLennan's various income sources and robust client demand, it could be an excellent stock to add to your portfolio today -- even if we find ourselves in a recession soon.