Interplay of 4f−3d interactions and spin-induced ferroelectricity in the green phase Gd2BaCuO5