According to Karl Marx capitalism is based on capital through which the capitalists purchase the labour of the workers on a lesser wage or price by way of profit and thereby increase their capital. In the process of increasing the capital the capitalists carry on the exploitation of the workers. Classes are the creation of capitalist society and in such a society class struggle is inevitable. The capitalists increase the means of production which are generally concentrated in certain places.
This concentration at places in the means of production enables the workers to come together. This coming together and organization makes them conscious of political force. Since they are exploited they are not able to live decently. In a capitalist society the state becomes puppet of bourgeoisie class. This capitalist class indulges in exploitation of proletariat or the labour through the state. All these acts ensure the opposition between the two classes.
According to Marx when the class struggle is accentuated the proletariats bring about the end of exploiters and establish the control over the means of production of the state. The dictatorship of the proletariats ultimately leads to establishment of a class less society.