Emergence of social hierarchies in a society with two competitive classes