Analytic study of opinion dynamics in multi-agent systems with two classes of agents