Dont expect to get a lot of replys other than questions.
Most folks will tell you this not a good practice and don't want to give advice that could destroy or injure.
More information is needed like size, load, speed and I for one do not recognize the material of the gear or the shaft.
And most of all why must you weld them? Welding will most likely weaken the shaft not to mention what problems the distortion from the heat will cause.