If a child is adopted by a stepparent or other relative of the child, an order of custody or visitation to a nonparent remains in effect and is not changed by the adoption unless modified, after notice to all parties to the custody or visitation proceeding, by the court that entered the order or the court that granted the adoption.
N.D.C.C. § 14-09.4-16