Britain’s Elinor Barker outsprinted Dutch four-time world champion Kirsten Wild to take gold in the women’s scratch race at the Track World Championships.