On a class of differential equations with self-reference