We get to see three house elf characters through the story, IIRC. One is Dobby, who's considered a freak by other house elves for wishing for freedom. The second is Winky (sp? Been a long fucking while), who is specified as being normal for a house elf and so goes into deep depression when she's freed. The third is Kreacher, a cantankerous old elf who was severely mistreated by most of the Black family (read: a bunch of assholes) but who remained loyal to them and particularly to the one that treated him with dignity (and who takes a shine to the main characters for doing the same). No one in the books except for Hermione considers them a wronged class, and the house elves themselves think she's annoying when she tries to free them. By the time they meet Kreacher she's learned her lesson and simply treats him (and other house elves) as humanely as she can.
Narratively, the house elves help show just how fucking weird the wizarding world is, and how applying muggle rules to it is not a good idea. It also explains how Hogwarts is kept maintained with only one janitor and one groundskeeper, and how the school's three meals are provided since you can't conjure food under that setting' magic system (and the elves of Hogwarts are described as a very cheerful bunch that are treated well by their master). Back in the day I thought it was an interesting way to show a non-human species with a very non-human mindset, but these days it's all just haram to people.