No matter how hard engineers try, the sun is always going to win the war. It merely is just too overpowering, and there is no reason even to try to combat it. But, with that said, speakers with UV-resistant components will last longer when exposed to the sun than those without UV-resistant components.
At the same time, no matter what, if you leave your boat speakers in direct sunlight, then they are going to deteriorate from the UV rays that the sun emits. It just may take longer for some models that are all.