The court may in like manner, upon application of either party or of a next friend in behalf of the minor children of the parties, make such order relative to the care and custody of such children during the pendency of the action for divorce as it may consider expedient and for their benefit.
Mass. Gen. Laws ch. 208, § 19