Because cast-spell has currently no range restrictions, I'm using attack to deliver spells to friendly units. Well, I was attacking with my cloaked air units supported by support aircraft, which was able to give shields to friendly units (increases armor). However, it didn't worked and I couldn't order attack on my own cloaked units. When I get them near detector, I could attack them normally. So cloaking also prevents friendly units from affecting it, unless detected. I think that this is unwanted feature, so I decided to make a bug report about it. Or was it intended feature?
I think you should always be able to do things to your own cloaked units.
I haven't tested if this applies to the cast-spell too.