Well...I don't know how they do it, but the best way I can see is as follows. Without getting to technical, you heat both the barrel and lug red hot and weld it in that state. then reheat and cool. If done properly, there are no ill side effects and the properties of the part will be unchanged. Not something I would try in the backyard. We have to do this sort of thing at work, from time to time on pressure containing parts.