if you never earn enough money to be able to afford to invest
That's a misconception. You can now buy shares in fraction depending on the investment platform. You can put however much money you want. Of course, the fewer shares you buy, the fewer the returns should the stock price increase (and fewer losses if share price goes down).