A father or a mother, provided they are lawfully living together as husband and wife, shall have an equal right to commence an action for an injury to their minor child, a member of the family; provided, however, that in the event such mother and father are not lawfully living together as husband and wife, or in the event legal custody of such minor child has been lawfully vested in either of the parties or some third party, then and in either event the party having legal custody of such minor child shall have the exclusive right to commence such action.