That is actually an interesting question come to think of it. Under the following situation.
AI or opposite player is a TEC rebel who's allied with the pirates.
You are a faction of anything other than a TEC rebel, but are allied with a TEC rebel.
Would you be immune to pirate attack as well.
I would doubt it. I would bet you are just as susceptible to pirate attack as anyone else other than the TEC Rebels who are allied with the pirates. Making for an interesting not so great alliance. As you would then be allied with someone who is allied with the pirates, but wouldn't share in the benefits of being allied to the TEC Rebels allied with the pirates. And at the same time, if you needed help with a pirate attack you are fending off, your so called ally would not only be unable to help you, but be unwilling to help you due to the TEC rebel player/ai losing the distinct advantage that being a pirate ally would bring. However, it would make for an interesting game mechanic that there could be a diplomacy pact with the TEC Rebels that should you increase your standing with a TEC Rebel player to a certain level, you could establish a Pact that would allow you to share in their benefit of being immune to pirate attacks regardless of what faction you are playing as. Everything else for you would remain the same as a non TEC Rebel in regards to your stance on pirates (such as not being able to use pirate ships). But via a Pact could share in at least the one benefit of being immune to pirate attack making a properly functional alliance. But also, you would no longer be able to attack the pirates either. So any other alliances you have would also create the same dynamic you initially had with the TEC Rebel before you were able to establish the pact.
I like it. It would certainly make a very cool dynamic for the gameplay. And promote the pacts side of the gameplay. Plus add a dynamic twist to not only being a TEC Rebel, but also the act of befriending a TEC Rebel. How effective the alliance is or not in early relationship and how beneficial it could become in late game. I really like that idea. Very interesting. Kudos Mew1... I hadn't considered that, but like where it could lead if the developers set it up properly.