Sometimes, but not necessarily always. I'm in UCU, the UK academics' union. We're quite often on the same side as the students, and not on the same side as the government. We get substantial support from students' unions on the basis that 'your working conditions are our learning conditions'. Casualisation, for example, is seen as substantially damaging good quality teaching for pretty small financial gains - but teaching is not in practice seen as a major priority by government or senior university managers.
We don't represent the public. Whether we're working on behalf of the public depends on whether you think the government's position represents 'the public', and which part of the public you're most interested in. (The interests of childless taxpayers who don't believe in the importance of university education are not well represented by lecturers and their unions, surprisingly enough...)
I think what I'm saying is that some of the conflicts between unions and management are zero-sum, but others are not. And while public sector unions can narrowly represent a producer interest, that certainly isn't true of all situations.