In the view of classical Marxism, the struggles of the working class against the attacks of the capitalist class lead the working class to establish its own collective control over production - the basis of socialist society. Marx believed that capitalism always leads to monopolies and leads the people to poverty; yet the fewer the restrictions on the free market, (e.g. from the state and trade unions) the sooner it finds itself in crisis.
...
Socialism
After the working class gains class consciousness and mounts a revolution against the capitalists, socialism, which may be considered the Fifth Stage, will be attained, if the workers are successful.
...
Some time after socialism is established society leaps forward, and everyone has plenty of personal possessions, but no one can exploit another person for private gain through the ownership of vast monopolies, and so forth. Classes are thus abolished, and class society ended. Communism will have spread across the world and be worldwide. Eventually the state will "wither away" and become obsolete, as people administer their own lives without the need for governments or laws. Thus, stateless communism or pure communism, which may be considered the Sixth Stage, is established,