If there is no guardian, parent or custodian or if the custodian is an agency or department, the written consent may be given, after notice to any agency or department appointed as custodian and hearing proper cause shown, by the court having probate jurisdiction.