Working for one professor, want to write paper with another party I am a PhD student working for a professor as a research assistant and being paid with stipends. One of my friends in the same department asks me if I can collaborate on a project branched off his PhD research. That project is a completely different field than my current research, despite of that some of the background ideas can be used in my part. 

He has done all of the theory work, and just needs someone to implement using computer programs. To me the task is not really hard at all, since he has streamlined the theories. I expect to finish the programming part without spending too much of my effort, and there is no (hard) time limit. 

Now he has generously offered me a chance to be in the authors list (I believe only us two, and he's the first), as the credit of my work. I understand that working for somebody else while getting paid for my own job is not good, but the publication is really luring to me. I talked to him about the chance of my name being included only in the acknowledgement, but what a bad idea of that. 

My question is what should I do? Should I ever talk to my professor? My friend is like hard to refuse since the work isn't really a burden to me. 

While I wish to keep anonymous, I truly thank you all for any idea, suggestion, or criticism. 



EDIT: As I mentioned before, our work isn't really very related. But it happens that at present I need to improve my own research methodology, and the techniques to be used in his project exactly fit my need. (I think this is a good lesson to me; never be "too" focused in my own research, and learn from other fields) Is it okay to talk to my advisor in this way, that while I'm helping him, I also make my own stuff better?
Ask your professor if it is okay with him.

During my PhD it was never a problem to work with other PhD's, it was actually well received and encouraged. Even collaborations that go beyond the professor's own group. Of course your own work should have priority, but spending some of your time on other projects has not been problematic.