You can use the parentMatrix node to change an object to its 'parent' by combining the original input matrix with multiple weighted parent matrix inputs. See parentMatrix in Transformation math nodes.
The multiple weighted parent matrix inputs are combined to create an output matrix that can be used as a parent matrix for an object, often connected to the offsetParentMatrix attribute of an object. You can animate weights, so that, for example, only one has the full effect at any time, or it can be a normalized combination of the inputs.
For example, imagine an object A that is placed between two other objects, P1 and P2. We might want object A to move with P1, or we might want it to move with P2, or perhaps we want to move it with both. Since the relative position of A to P1 is different than its relative position to P2, we cannot use the world matrices of P1 and P2. In this way, the parentMatrix node captures an offsetMatrix for each target to represent these relative positions.