In Fire and the Sun: Why Plato Banished the Artists, Iris Murdoch claimed that “[a]rt is far and away the most educational thing we have…” Here she is discussing this notion, among many others, with the philosopher Bryan Magee.
You can also read an interview with Murdoch in the Paris Review. Here’s an excerpt:
Should the novelist also be a moralist and teacher?
Moralist, yes. Teacher suggests something rather more didactic in tone. A novelist is bound to express values, and I think he should be conscious of the fact that he is, in a sense, a compulsory moralist. Novelists differ, of course, in the extent to which they set out to reflect on morals and to put that reflection into their work. I certainly do reflect and put this reflection into my works, whether or not with success. The question is how to do it. If you can’t do it well, you had better not do it at all. If you have strong moral feelings, you may be in difficulties with your characters because you may want them to be less emphatic than you are yourself. In answer to your question, I think a novelist should be wary of being a teacher in a didactic sense, but should be conscious of himself as a moralist.
I would also recommend giving the movie Iris a viewing, which stars both Judi Dench and Kate Winslet as the philosophical author at different stages of her life.