Except most contracts in the private sector (IT, finance, etc.) are not between two consenting adults. They are usually between one consulting adult and a huge corporation, a corporation that can choose to pay a certain class of people unfairly and still survive in business. It is in the interest of such corporations to maintain this asymmetry of information where they can know your salary and all your colleagues' salary but would discourage you from knowing your colleague salary.
If you think salary being private data is the obvious assumption, then think again, maybe you have been conditioned by years of employment in the private sector to believe that salary is private data. In many cultures and in many type of jobs, it is not considered private data.