is it possible to add two developers to the development of an app? I am just starting to work with XCode and I am kind of lost. I am working on an iOS app and I want to add a friend who will help me to develop the app. 

How can we both work on the app? is there any way to achieve this? If I add him on my account as a team member, will he be able to see the source code?

Thank you for your help.
To work together on any development project, you preferably need a version control system like GIT or SVN. Apple supports this with Xcode Server. If you're not working on the app at the same time, I imagine that DropBox or any other file sharing system would work as well.

Being on the same Apple Developer team would hardly mean anything in this matter at all. Note that you need to apply as a company to the Apple Developer Program in order to have more team members. The only direct benefit during development is that you can use the same certificates for distributing your app. The package you upload to iTunes Connect for distribution via the App Store is a binary, a compiled version of the app from which it is not possible to extract the source code.