The S&P 500 is officially in a bear market, and is off to its worst start in more than 50 years.

Bear markets can be mentally taxing, but they all end eventually and can be opportunities to buy great companies at discounted prices. Companies with competitive advantages and strong cash flows can deliver market-beating returns over the long run, and are also well-positioned to capitalize during market downturns. Here are three companies that rake in cash consistently that you can add today -- and should help you sleep a little easier at night.

A person reviews information on a computer and a tablet.

Image source: Getty Images.

1. Mastercard

Mastercard (MA 1.30%) operates the world's second-largest payments network, helping customers move money globally through its credit and debit cards and other payment products.

Mastercard's payment network gives the company a major competitive advantage because of the network effect, meaning as the network grows, it's harder for competitors to come in and take away business. The network effect is also why Mastercard and Visa dominate the payments market, holding 90% of the credit and debit card markets.

You can visualize this competitive advantage when looking at Mastercard's profit margin, which has averaged nearly 40% over the past decade. Mastercard's business is also relatively asset-light, and its free cash flow, or cash left over after paying for operating expenses and capital assets, has grown at almost a 13% compound annual growth rate in the last decade.

MA Free Cash Flow Chart

MA Free Cash Flow data by YCharts

Strong free cash flow helps Mastercard reward investors through dividends and share buybacks, and allows it to ride out the waves through different economic cycles. While other companies play defense as economic uncertainty persists, Mastercard can play offense and make acquisitions at deep discounts -- among the reasons it could be an excellent addition to your portfolio.

2. S&P Global

S&P Global (SPGI -0.87%) gives ratings to companies worldwide and is an integral part of debt markets. When companies want to raise money by selling debt, credit rating agencies like S&P Global evaluate the companies' risks and assign grades that determine how much interest they pay.

Regulations make it difficult to crack into the credit rating business. This high barrier to entry gives S&P Global a considerable advantage, and is why S&P Global has a 40% market share, about the same as Moody's Corporation.

This competitive advantage translates into high gross profit margins, which have averaged nearly 70% over the last decade. These high margins are a big reason why S&P Global's free cash flow has grown at a 15% rate compounded annually.

SPGI Gross Profit Margin Chart

SPGI Gross Profit Margin data by YCharts

One thing to keep in mind is that 50% of S&P Global's revenue comes from its credit ratings business -- which has slowed down drastically this year as debt issuance has fallen 35% in the U.S. Despite this, S&P Global's other business units, such as research, analytics, and index products, grew 51% from last year, and the company's total revenue grew from last year.

S&P Global's position as a top rating agency and its asset-light business model make it another stellar cash-generating stock you can add today that will help you sleep easy at night.

3. Progressive

Progressive (PGR 0.48%) primarily writes auto insurance policies for individuals and businesses. The company has developed a competitive edge, pricing its policies by analyzing driving behavior, known as telematics.

Telematics is a technology that tracks driving behavior using data collected from a device installed in your car or through the app on your phone. The data Progressive collects include things like mileage driven, speed, braking time, and the time of the day driven. It then develops customized rates, which can give drivers discounts for safe driving. Progressive made this widely available in 2011 through its Progressive Snapshot product, giving it a first-mover's advantage.

This technological advantage has translated into industry-beating, profitable policies for Progressive for years now. One way to measure profitability in the insurance industry is the combined ratio. This ratio is the total losses from insurance claims plus operating expenses divided by total earned premiums. A ratio below 100% means a company is writing policies at a profit; the lower the percentage, the better. Progressive's combined ratio has consistently outperformed the industry for 20 years now.

A chart shows Progressive's combined ratio compared with the industry since 2002.

Data source: Progressive 10-K filings, Statista and NAIC for P&C industry averages. Chart by author.

This strong underwriting ability is why Progressive's free cash flow has grown at a 17% rate compounded annually over the last decade.

PGR Free Cash Flow Chart

PGR Free Cash Flow data by YCharts

Progressive faces growing threats as more companies incorporate telematics into their businesses. However, the company has years of data ahead of the competition, which should help it continue outperforming the industry.

Progressive's technology and attention to detail in writing profitable policies make it another excellent cash-generating stock you can add to your portfolio that will help you rest easy.