Can i connect a att iphone with another company?

So my friend is giving me her iphone 5 but its for att but when you look the phone it saids no service and i would like to know if its possible to connect the phone to like virgin mobile or any other company…

Go there and find out.

As long as it is not locked to a particular network then it can be used on any carrier. If you are 100% sure its AT&T it is best to contact them and find out if the phone is still locked to their network or not by providing your IMEI number. Your IMEI number is located in Settings> General>About> IMEI or by pressing *#06# on your keypad

She can get AT&T to unlock it if her account is in good standing. Then it'll still work with AT&T, but also with any other company that uses SIM cards. Don't accept the phone from her until you know it works, and she can promise you that she unlocked it. The page below from AT&T explains how to unlock.

You would have to get the phone unlocked. Wouldn't matter to do that for Virgin though since that is a CDMA network.