Wondering this since I have an Iron Ball Groudon, and a Flower Gift Cherrim, and I wanted to do something dumb and gimmicky today
As shown in this replay, it does affect it. You can't see the stats, but both Groudon's Attack and Special Defense retained the boost. If you don't believe me, use the same setup, and try it youself.
Hope I helped!