Exchange interactions in rare earth—transition metal compounds