I lived in Vienna for over 20 years. Social housing is part of it. There are enough apartments available to house roughly 1/4th of the population. Average waiting time is 1-2 years to get one. So it doesn't work for everyone. But the requirements to get one are reasonable. The middle class has access to them.
On top of that, Vienna has some rent control. Houses built before 1953 have a legal maximum for rent. And a lot of buildings are older than that. Newer buildings that took advantage of government grants also have rent limits. And then there are Genossenschaftwohnungen. They are built by "non-profit" developers (not quite right but close enough). They also have rent control.
So there are a shit ton of affordable apartments available. And that keeps even the rent of units that aren't directly controlled in check. Obviously there are a few buildings and locations that still charge outlandish rent. But no one is forced to take them.
Of course landlords find ways to go beyond the limit. But we are talking at most $100-200 a month higher. Not outlandish higher. Because there are a lot of easy to use tools to check your rent price. You just put in what you pay, where you live and it will tell you if it's allowed or not. If they charge too much there are resources available to have the rent fixed and you get paid back what you overpaid.
Plus the law really favors renters. Perpetual rent contracts are the norm. Term-Limited rent contracts have a mandatory discount added to them. And they are limited to one extension. The second one would turn it into a perpetual contract. So landlords have a hard time getting rid of existing tenants/contracts. Or end up paying a lot for real estate agent fees.