(the ball = subject) The boy kicked the ball (the boy = subject; the ball = direct object) I passed the ball to the boy (the boy = indirect object; the ball = direct object) ‘the boy’ works as the subject in the second example, but it is the indirect object in the third one.
(Der Ball = subject [nominative]) Der Junge trat den Ball (Der Junge = subject; den Ball = direct object [accusative]) trat Ball (Der Junge = subject; den Ball = Ich habe den Ball an den Junge n weitergege