It's been a tough year for investors, with the S&P 500 index down 15% since the start of the year. Despite weakness in the market, one industry is holding up quite nicely: insurance. This year, the SPDR S&P Insurance ETF (KIE -0.16%) is up nearly 5% at a time when market volatility and rising interest rates have weighed on many other stocks.

While insurance isn't the most thrilling industry, it is a necessary business that can be a great source of cash flow. This cash flow is a big reason Warren Buffett loves owning insurance companies, which have been a pillar of his success over 57 years at Berkshire Hathaway.

There are other reasons to love insurance stocks. These companies are a natural hedge against inflation and can do well in higher interest rate environments. Let's dive deeper into why insurers can make for excellent investments.

Consistent demand makes insurance companies cash flow machines

Insurance is always in high demand, partly because of laws requiring insurance on cars, homes, or businesses. It also has robust demand as individuals and businesses protect themselves or their property from unforeseen events. While paying premiums monthly is no fun, these companies help protect individuals and businesses from catastrophes that could otherwise wipe them out financially.

Insurers are also excellent cash flow generators. That's because their cash flows are in reverse compared with your typical company. Insurers collect their fees up front, in the form of premiums, before ever rendering service. They provide their service only if and when a customer files a claim. The time between collecting premiums and paying out claims gives insurers something called "float," or other people's money they can hold and invest.

When an insurance policy ends without claims, the company keeps that money and puts it to work in longer-term investments -- and is a significant reason why Berkshire Hathaway owns several insurance companies, including Berkshire Hathaway Reinsurance, General Re, and GEICO.

Why insurers can adapt to inflationary pressures

Insurers can provide your portfolio with a solid hedge against inflation. That's because as claims data rolls through, insurers can see if costs are rising rapidly and adjust their premiums relatively quickly.

For example, last year, Progressive (PGR -0.85%) noticed that accidents had increased in frequency by 14%, while the cost of resolving those claims was up 9%. A big part of this was the increase in used car prices, which were up as much as 27% last year.

Progressive was able to respond quickly by raising its premiums charged while also eliminating specific policies that were causing sizable losses. This year, Progressive's net premiums written increased by 10% -- evidence of the company's ability to adapt to inflation

Insurers welcome higher interest rates

Aside from collecting premiums, insurers invest excess cash as another way to generate income. During that last decade of ultra-low interest rates, insurers have struggled to generate good investment returns. While some invest aggressively in stocks, like Markel, others are much more conservative and invest in government bonds and other safer instruments.

When interest rates rise, insurers can put their cash to work in higher interest-earning income. For example, one Warren Buffett holding, Globe Life, recently reshaped its portfolio, selling riskier assets while investing that cash in higher-quality debt that delivers a higher yield.

In the third quarter, Globe Life put $431 million to work in investment-grade securities, and the average yield on its new investments was 5.56%. This is above its portfolio yield of 5.17% and represents the first time the average yield on its portfolio has increased since 2008. If interest rates stay higher for longer, it will serve as another tailwind for insurers moving forward.

Worth the investment

Insurance companies have posted solid returns in a year when many other industries are in the red. The industry has done an excellent job of adapting to inflation, and higher interest rates are another tailwind that should benefit these businesses as we advance. While stocks in the industry are up a fair amount this year, it's still not too late to invest in insurers that can do well no matter what the market does.