Quoted or direct speech:
He laid down his bundle and thought of his misfortune. "And just what pleasure have I found, since I came into this world?" he asked.
Reported or normal indirect speech:
He laid down his bundle and thought of his misfortune. He asked himself what pleasure he had found since he came into the world.
Free indirect speech:
He laid down his bundle and thought of his misfortune. And just what pleasure had he found, since he came into this world?
Unless you are reading carefully and looking for it, which in the case of these examples you are, it is easy not to notice the change to free indirect discourse in the third example.
Free indirect discourse has been in use in literature since at least the early nineteenth century. (Some scholars argue that Chaucer made use of it in The Canterbury Tales which would push back the date to the fourteenth century.) Critics often credit Jane Austen with refining the technique. Gustave Flaubert, James Joyce, Franz Kafka, and Virginia Woolf are also known for exploiting free indirect discourse.
So why use this technique? It's a clean way to get into a character's head without distracting quotes and introductory phrases. In her essay "Free Indirect Discourse and the Clever Heroine of Emma", Louise Flavin hits on a more important reason, controlling the distance between reader and character.
While it is not possible to know if Austen was consciously aware of free indirect discourse as a stylistic device, there appears to be striking evidence that she understood its significance as a means of controlling the reader’s sense of distance from characters.
Let's end with a couple examples from Austen and Joyce:
She was not struck by any thing remarkably clever in Miss Smith’s conversation, but she found her altogether very engaging – not inconveniently shy, not unwilling to talk – and yet so far from pushing, shewing so proper and becoming a deference, seeming so pleasantly grateful for being admitted to Hartfield, and so artlessly impressed by the appearance of every thing in so superior a style to what she had been used to, that she must have good sense and deserve encouragement.
--Jane Austen, Emma
Gabriel could not listen while Mary Jane was playing her Academy piece, full of runs and difficult passages, to the hushed drawing room. He liked music but the piece she was playing had no melody for him and he doubted whether it had any melody for the other listeners, though they had begged Mary Jane to play something.
--James Joyce, "The Dead"