If the enemy sub doesn’t choose to submerge first, both ships can attack it.  Only air units require a destroyer to allow them to attack subs.