Gold. Up 4000% in 40 years. The Dow Jones up only 1100% in 40 years. Ofcourse as pointed out one can prove anything if you can chose the timeline...
Dow was about 800 in 1970, about 12,000 now. That's about 6.8% average return.. plus what, 3% average dividend? That's about 10%/yr.
Inflation adjusted S&P500 returns with and without reinvested dividends since 1950: http://www.simplestockinvesting.com/SP500-historical-real-total-returns.htm
With real estate, assuming that property values have gone up on average 4-5% a year..... rents-costs, and tax benefits of depreciation on the house +appliances, deductible on interest payment ect. you can make 20-40% a year on your original downpayment per house. So if you bought rental houses with 1 million 40 years you would be sitting pretty. After the house mortgage is paid off you make even more .
Keep in mind , like any investment, there are variables that effect the ROI. Your personal tax situation, interest rates, average rents, price paid for house and when. So it is hard to compare stocks vs realestate because of these variables but those are two examples of what is possible.