Parent selectors are used to select the parent elements in nested selectors of LESS code

let’s see simple example

<div class="parent">
  <div class="child"</div>
</div>

You want to apply the styles to child element using parent selector. So we have to use & operator to select parent selector

here is an less code

.parent{
  color:blue;
  & .child{
    color:green;
  }
}

Generated CSS

.parent {
  color: blue;
}
.parent .child {
  color: green;
}

Parent selectors are used with class or pseudo-class

And also we can also change the parent selector order with append & in the last The same can be rewritten using & operator

.child{
  color:blue;
  .parent & {
    color:green;
  }
}

Generated CSS

.child {
  color: blue;
}
.parent .child {
  color: green;
}

pseudo parent selectors example

psuedo classes are used to attach an events with css

Anchor tag has hover class

a{
  color:blue;
  &:hover{
    color:green;
  }
}

Generated CSS

a {
  color: blue;
}
a:hover {
  color: green;
}

Nesting and parent selectors are important in Preprocessor to have a clean code with hierarchy of like dom tree in CSS.