It's been a tough year for investors as the major indices have entered bear market territory.

The Federal Reserve had just hiked interest rates for the seventh time this year, taking the benchmark rate to between 4.25% and 4.5% as it seeks to tame the highest inflation the U.S. has seen in four decades. There could be more pain ahead, too, as the central bank is signaling more rate hikes next year, and many business owners are expecting the economy to enter a recession.

What you need to remember is that recessions are an inevitable part of the economic cycle and should not be feared. Valuations and share prices naturally decline during a downturn, but you can view these drops as opportunities to pick up solid companies on the cheap. In particular, you should target stocks with strong competitive moats and franchises that pay out rising dividends as these are more likely to weather a recession without going bankrupt.

Here are three stocks that can keep your capital safe should the economy tank.

Hamburger and french fries

Image source: Getty images.

McDonald's

McDonald's (MCD -0.40%) is one of the most recognizable fast-food chains in the world with its signature golden arches. The company has nearly 40,000 outlets in more than 100 countries around the globe -- and with more than 95% of its restaurants operated on a franchised basis. The business has proven resilient throughout the COVID-19 crisis, and is also recession-proof, as food and beverages remain staples that people cannot do without.

Total revenue went from $21.4 billion in fiscal 2019 (FY2019) to $23.2 billion in FY2021, with a dip seen in FY2020 due to temporary store closures. Similarly, net income also saw a year-over-year decline from FY2019 to FY2020 but picked up again in FY2021, rising to $7.5 billion over the pre-pandemic level of $6 billion.

Investors should note that McDonald's continued to generate consistent free cash flow throughout these three fiscal years, allowing the fast-food giant to pay out rising dividends through the pandemic. The quarterly dividend of $1.52 is up 10% from $1.38 a year ago. McDonald's has raised its dividend for 46 consecutive years, taking it ever closer to becoming a Dividend King.

Procter & Gamble

Proctor & Gamble (PG -0.37%) is famous for its wide variety of well-known consumer brands such as Pantene, Pampers, Oral B, and Gillette. But what many investors may not realize is that the company is also a bastion of stability during both good times and bad. The last five fiscal years (ended June 30) have seen the company's revenue steadily grow from $66.8 billion in 2018 to $80.2 billion in 2022. Net income has also risen from $9.8 billion to $14.7 billion during this period.

The really impressive thing is that Procter & Gamble managed to continue growing its net income even during the pandemic. The company, like McDonald's, is also adept at generating free cash flow, with an average of $14.4 billion in free cash flow generated over the last three fiscal years.

The consumer goods giant has carried on its top-line growth momentum in the first quarter of its fiscal 2023, with net sales inching up 1% year over year to $20.6 billion. The cost of goods sold had risen in line with higher inflation, resulting in net income dipping by 4% year over year. Free cash flow, however, remained solid with $3.2 billion generated versus $3.4 billion a year ago.

Procter & Gamble has raised its dividend over 66 consecutive years, and looks set to continue doing so for the foreseeable future.

American Tower

American Tower (AMT -0.27%) is a real estate investment trust (REIT) that owns around 233,000 communication towers that are leased to telecommunication services companies and wireless service providers.

The REIT generates very consistent rental income from long-term leases that have rental escalation clauses embedded in them. These leases are mostly non-cancellable, ensuring American Tower receives a dependable flow of rental income that tracks the inflation rate.

Moreover, the REIT also enjoys a high renewal rate as its tenants lack alternative sites, thereby protecting American Tower from sharp fluctuations in rental income when leases expire. Coupled with low capital expenditure requirements for maintenance, these attributes ensure that the REIT is well-insulated from economic storms and yet can pay out a steady distribution.

American Tower's distribution per share has steadily increased over the years, starting at just $0.90 back in 2012 and increasing nearly six-fold to $5.21 by 2021. For its latest third quarter, the REIT declared a dividend of $1.47 per share, up 12.2% year over year, for an annualized dividend per share of $5.88. 

There could be more upside for the REIT as it partners with Stonepeak, an alternative asset manager with expertise in managing infrastructure assets. Stonepeak will acquire a 29% ownership interest in American Tower's data center business. This partnership creates a platform for both companies to grow their presence in the data center space as the 5G ecosystem continues to expand.