In basketball, a "loose ball", is deflected by an offensive player directly to a defensive player already out of bounds. Does the possession changes from offense to defense?
NBA Rule 8. II. c. says in part:
If the ball is out-of-bounds because of touching a player who is on or outside a boundary, such player caused it to go out.
If the ball hadn't touched anything out-of-bounds before contacting the defensive player, then it is ruled out-of-bounds due to that defensive player. No change of possession.
The defensive player has to be in the game though. If it's a member of the team standing at the sideline but not in the game, and that defensive player wasn't doing anything to constitute interference, then it's out-of-bounds off the deflecting offensive player.