It is possible for a sentence containing an indirect object to be rewritten by placing a preposition before the indirect object. When this is done, the original indirect object can be regarded either as the indirect object of the verb, or as the object of the preposition.
For example, the sentence We gave the child a toy, can be rewritten as follows:
We gave a toy to the child.
In the rewritten sentence, child can be regarded either as the indirect object of the verb gave, or as the object of the preposition to.