Empirics of the median voter: democracy, redistribution and the role of the middle class