Siemens profit beats forecasts helped by accounting gain