How did Frederick William gain power in Prussia?