Unbroken 165-run stand leads Glamorgan recovery after Surrey's early strikes